Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when opening settings and exiting #11

Closed
m93a opened this issue Jan 6, 2017 · 13 comments
Closed

error when opening settings and exiting #11

m93a opened this issue Jan 6, 2017 · 13 comments
Assignees
Labels

Comments

@m93a
Copy link

m93a commented Jan 6, 2017

I've got a fresh install of v0.5.0 (I downloaded the AlwaysOnTop-Installer.exe). When I try to open the settings window, the JIT runtime throws this error:

************** Text výjimky **************
System.NullReferenceException: Odkaz na objekt není nastaven na instanci objektu.
   v AlwaysOnTop.Classes.FormSettings.FormSettings_Load(Object sender, EventArgs e)
   v System.Windows.Forms.Form.OnLoad(EventArgs e)
   v System.Windows.Forms.Form.OnCreateControl()
   v System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   v System.Windows.Forms.Control.CreateControl()
   v System.Windows.Forms.Control.WmShowWindow(Message& m)
   v System.Windows.Forms.Control.WndProc(Message& m)
   v System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   v System.Windows.Forms.Form.WmShowWindow(Message& m)
   v System.Windows.Forms.Form.WndProc(Message& m)
   v System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   v System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   v System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Its in Czech but basically it says Text of the exception and Link (pointer?) is not set to the object's instance. However if I click Continue, it runs anyway. Similarly if I choose to exit the program, an error shows up, this time:

************** Text výjimky **************
System.NullReferenceException: Odkaz na objekt není nastaven na instanci objektu.
   v AlwaysOnTop.MyCustomApplicationContext.Xit(Object sender, EventArgs e)
   v System.Windows.Forms.MenuItem.OnClick(EventArgs e)
   v System.Windows.Forms.MenuItem.MenuItemData.Execute()
   v System.Windows.Forms.Command.Invoke()
   v System.Windows.Forms.Command.DispatchID(Int32 id)
   v System.Windows.Forms.NotifyIcon.WndProc(Message& msg)
   v System.Windows.Forms.NotifyIcon.NotifyIconNativeWindow.WndProc(Message& m)
   v System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

My system info:

Edition: Windows 10 Home x64
Version: 1607
Build: 14393.576

More debug info:

************** Načtená sestavení **************
mscorlib
    Verze sestavení: 4.0.0.0
    Verze Win32: 4.6.1586.0 built by: NETFXREL2
    Základ kódu (CodeBase): file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
AlwaysOnTop
    Verze sestavení: 0.5.0.0
    Verze Win32: 0.5.0
    Základ kódu (CodeBase): file:///C:/Program%20Files%20(x86)/jParnell/AlwaysOnTop/AlwaysOnTop.exe
----------------------------------------
System.Windows.Forms
    Verze sestavení: 4.0.0.0
    Verze Win32: 4.6.1586.0 built by: NETFXREL2
    Základ kódu (CodeBase): file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Verze sestavení: 4.0.0.0
    Verze Win32: 4.6.1586.0 built by: NETFXREL2
    Základ kódu (CodeBase): file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Verze sestavení: 4.0.0.0
    Verze Win32: 4.6.1586.0 built by: NETFXREL2
    Základ kódu (CodeBase): file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
mscorlib.resources
    Verze sestavení: 4.0.0.0
    Verze Win32: 4.6.1586.0 built by: NETFXREL2
    Základ kódu (CodeBase): file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_cs_b77a5c561934e089/mscorlib.resources.dll
----------------------------------------
System.Windows.Forms.resources
    Verze sestavení: 4.0.0.0
    Verze Win32: 4.6.1586.0 built by: NETFXREL2
    Základ kódu (CodeBase): file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_cs_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------

I've got Visual Studio 2015, very basic knowledge of C# and I'm willing to help with debugging, if it doesn't take too much time.

@jparnell8839
Copy link
Owner

The only thing that jumps out as a possible culprit is it being a regional thing, however this is doubtful. This is kind of why frameworks like .Net are so useful.

Please install this special build attached; I have implemented a lot of Try...Catch statements, especially in calling the Settings dialogue box. Send me some screenshots of any error messages that appear; they should all be handled now, if it has anything to do with the Settings form class.

AlwaysOnTop-Installer_v0.5.1_b170106.2337.zip

@jparnell8839 jparnell8839 self-assigned this Jan 7, 2017
@m93a
Copy link
Author

m93a commented Jan 12, 2017

The error when exiting the app is still the same:

vystrizek

The error window when opening the settings has changed, but the message is virtually the same:

error

@jwhipp
Copy link

jwhipp commented Jan 16, 2017

+1, same issue on Windows 10 Pro build 15007

@jwhipp
Copy link

jwhipp commented Jan 16, 2017

English version of the stack trace, just in case due to the possibility of it being a regional thing.

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at AlwaysOnTop.Classes.FormSettings.FormSettings_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.ContainerControl.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)

************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2020.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

AlwaysOnTop
Assembly Version: 0.5.1.0
Win32 Version: 0.5.1
CodeBase: file:///C:/Program%20Files%20(x86)/jParnell/AlwaysOnTop/AlwaysOnTop.exe

System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2020.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2020.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2020.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2020.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2020.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2020.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

@jparnell8839
Copy link
Owner

Interesting... I never had this issue before, but I just reinstalled Windows 10 build 1607 on my dev PC (had OneDrive issues anyway), and now I get the same thing, but only when I'm running from the installed application (the debugging app, which is wrapped around vshost.exe, still works fine). This tells me there's a dependency issue in the installer and that I'm leaving something out when compiling.

Do either of you get the same results when opening other dialogue boxes (About or Help)?

@jwhipp
Copy link

jwhipp commented Jan 16, 2017

Appears to only happen with settings, I tried all the other tray options.

@jwhipp
Copy link

jwhipp commented Jan 16, 2017

I forgot to mention, I haven't used the special build. Would it be helpful if I tried that?

@jparnell8839
Copy link
Owner

@jwhipp are you using 32 bit Windows or 64 bit?

So this started happening to me (see above, reinstalled Windows), until I installed Visual Studio. There was a couple Visual C++ packages that got installed alongside Visual Studio 2015 Community

@jwhipp & @m93a , I am attaching a batch script that will search your registry for all installed software labeled "Visual C++". It will output a file called "software_list.txt" in the same folder as the batch script. Please run that script and attach the text file in a reply. May have a solution very soon.

@jparnell8839
Copy link
Owner

Also attaching the Visual C++'s I have installed, as I'll likely be at work before I see this, rather than home.

Installed Visual C Plus Plus.zip
software_list.txt

@jwhipp
Copy link

jwhipp commented Jan 17, 2017

Windows 10 Pro 64 bit

software_list.text:

Visual C++ Packages Installed

"Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005"
"Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005"

@jparnell8839
Copy link
Owner

Ok, good news is I have found the cause of the unhandled exception in the Exit method.

In my primary class, I had a check against the user settings in the registry... if Use Hotkey = 1 and Hotkey != "", register a globalKeyboardHook and provide it the keys signaled in the registry.

The Exit method was calling the unhook method in the keyboard hook, so that any hotkeys registered would be de-registered. Since conditionals will only declare that IF the condition is true (so only in half scenarios) .Net was saying "Ok, this object may or may not exist, so let's throw a vague exception".

This is fixed by added an Else { } statement and declaring a blank globalKeyboardHook that does not register any keys or key events. This fix will be implemented in the next release.

Now on to troubleshoot the Settings exception....

@jparnell8839
Copy link
Owner

And more good news. Found the settings crash. Turns out, if the hotkey was never set, it never created a registry entry. When the settings was opened, it was trying parse and separate the registry setting into the separate keys (modifier + key). If that setting was blank, it was returning NULL - so rather than checking to see if the setting returned "", it now determines if the string IsNullOrWhiteSpace (so it checks for null, "", or whitespace".

Fixes are implemented in code, will be fixed in next release (waiting until I get the updater portion corrected)

@jparnell8839
Copy link
Owner

Bug fixed in version 0.6.1. Please download and install that version.

Thanks for catching this guys - I really need to set up a "clean" VM to test my products on, and will do that in the near future, to hopefully avoid this issue.

Let me know if you encounter any new bugs by filling out a new issue. If this one requires re-opening, please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants