Having problems getting my code to run on non dev machines.
All machines are win 10 and my code targets .Net 4.6 which is supposed to ship with it.

On one machine I had a problem where an exception to do with System.Data.SQLite was thrown and on another I had the following...

System.NullReferenceException: Object reference not set to an instance of an object.
at RegEditor.ObjectBase.RetrieveFromRegistry(NPCheckBox npc)
at RegEditor.Form1.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
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.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(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)

And I just cannot figure it out, all the at at at, are they all exceptions?
The code will run from anywhere on dev machine, but nowhere outside of it.

Any help much appreciated, and thank you for looking.

Recommended Answers

All 5 Replies

It is obvious you are referencing a null pointer somewhere. If you don't have a dev environment at hand, you could try to make a special version of the program with MessageBoxes, to try to pinpoint the problem.

I'm not sure I'd know where to put debugging message boxes.

The only method shown in that log, which is defined by me is "RegEditor.ObjectBase.RetrieveFromRegistry(NPCheckBox npc)"
so I suppose I'll start there.

Thanks for advice.

I do have my dev machine, but no errors occur on it to debug.

At the point it's breaking all it's doing is getting a value from registry, and either checking or not, the referenced custom checkbox "RetrieveFromRegistry(NPCheckBox npc)" passed to it.

Perhaps under certain circumstances npc can become null? MessageBox or writing to a log file might be your only help.
And perhaps some compiler directives can come in handy to switch between a "debug" and "normal" version of your program.

Was sound advice to debug with message boxes, I believe I have found the issue.
A registry value did not exist on non dev machine and that it where the null is coming from.

I've re-written this app a few times, and forgotten to create keys and values if they do not exist in later versions.

Thank you ddanbe, I'm back in the race now.

I'll deal with the SQLite problem when I'm happy this is sorted.

Much appreciated.

Always glad I can help. Success! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.