1

I trying to find out why a VB.NET application has stopped working and gives the following error when opening:

************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object. at System.Object.GetType() at OneFrm1.Form1.sub_something(Object array1, Object O1, Object O2) at OneFrm1.Form1.add_square_op1_to_array(square_area_options& array1, String v) at OneFrm1.Form1.sub_something(Object array1, Object O1, Object O2) at OneFrm1.Form1.load_date_panel_format_array() at OneFrm1.Form1.Form1_Load(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

The application works fine if I right click and run as 'another user' but gives the above error if running as the logged-in user. I have tried a new user profile and it still gives the same error. The same issue with security software removed.

The other user has the same rights.

CBP
  • 11
  • 2
  • Users have access rights to specific parts of the filesystem, for example. Maybe you're accessing a path that *another user* can access and the current user cannot. Then, if you have an empty `Catch` block, you eat up the exception when you access a *forbidden* resource and when you try to use an object that a failed procedure should have generated, this object is null. Just a possible cause, you should have some error logging in place. – Jimi Jan 21 '20 at 12:05
  • Thanks, Jimi, when trying the other user they have the same rights (local admin). One affected system is a screen display which has not been updated recently, no changes to the user account and has all of a sudden got this error. – CBP Jan 21 '20 at 12:10
  • Well, an *application has stopped working and gives the following error*, when the exception is a very generic one, is not very helpful. You should t least specify when/doing what you get the exception. On startup? What is the application supposed to do at this point? In a different moment? Same question. – Jimi Jan 21 '20 at 12:13
  • I know and the creator of the application is no longer around. I'm just trying to get it working again. I have put the full error message in the post now. – CBP Jan 21 '20 at 12:27
  • You have a couple of methods that should generate/fill/use these `Object array1, Object O1, Object O2` on Form.Load. The type of these objects (`Object`) and the name of the methods `sub_something`, `load_date_panel_format_array` don't give much of a clue. This is a matter of debugging the application and logging functions results/exceptions. – Jimi Jan 21 '20 at 12:37
  • Compile it with DEBUG configuration and start the application again. Then you see the line number on which the NullReferenceException occurs. Or in Visual Studio, hit Alt-Ctrl-E, ensure the debugger stops at managed exceptions and start the debugger with F5. – Christoph Jan 22 '20 at 12:48
  • This is beyond my skill set and I would imagine that you would not get a NullReferenceException as the application works on 95% of the workstations – CBP Jan 27 '20 at 12:42

0 Answers0