KeyPuncher / WiinUPro

Microsoft Public License
412 stars 52 forks source link

application hang on exit #92

Open trei49 opened 2 years ago

trei49 commented 2 years ago

Sometimes when I try to exit wiinupro, the app stops responding. Even after clearing off its process in task manager, the app will keep crashing when trying to reopen it again, until PC is rebooted. Trying to reboot PC via restart or shutdown, or even just going into sleep will hang the PC at the restart screen; I must hard-press physical power on PC to turn it off.

I have experienced this now and then for many months now, but assumed it was just devreorder-related issues. But I just recently decided to stop using devreorder and realize this still happens.

Can't reproduce this issue on demand. Running app with admin does not help. Versions earlier than 0.9.7 did not have this issue.

KeyPuncher commented 2 years ago

First time I'm hearing of an issue like like this. Next time I'm in the code I'll look around for any curious changes I've made. In the meantime the next time this occurs try to gather as much info about the setup like controller you're using, how long you've been playing, what you've been playing, how much memory/cpu is being used by WiinUPro, Windows version number and anything else you can think of.

Also, if you go back one version and use it consistently just to confirm it's just 0.9.7.

trei49 commented 2 years ago

Controller used is wiimote plus RVL-CNT-01-TR + classic controller pro, happens randomly sometimes after days, sometimes after weeks. Average 30MB memory, 1-2% CPU Windows 10 21H2 19044.1586

Might this help? Just noticed this today - similar logs date back to April 2021

Source: .NET Runtime Event ID: 1026 Level: Error

Application: WiinUPro.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.NullReferenceException at WiinUPro.NintyControl.RefreshToolTips() at WiinUPro.NintyControl.LoadProfile(System.String) at WiinUPro.DeviceStatus.connectBtn_Click(System.Object, System.Windows.RoutedEventArgs) at WiinUPro.DeviceStatus.AutoConnect() at WiinUPro.MainWindow.Refresh() at WiinUPro.MainWindow.Window_Loaded(System.Object, System.Windows.RoutedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean) at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs) at System.Windows.BroadcastEventHelper.BroadcastEvent(System.Windows.DependencyObject, System.Windows.RoutedEvent) at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(System.Object) at MS.Internal.LoadedOrUnloadedOperation.DoWork() at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks() at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object) at System.Windows.Media.MediaContext.RenderMessageHandler(System.Object) at System.Windows.Interop.HwndTarget.OnResize() at System.Windows.Interop.HwndTarget.HandleMessage(MS.Internal.Interop.WindowMessage, IntPtr, IntPtr) at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

AND

Application: WiinUPro.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.NullReferenceException at WiinUPro.NintyControl.RefreshToolTips() at WiinUPro.NintyControl.LoadProfile(System.String) at WiinUPro.DeviceStatus.connectBtn_Click(System.Object, System.Windows.RoutedEventArgs) at WiinUPro.DeviceStatus.AutoConnect() at WiinUPro.MainWindow.Refresh() at Shared.Windows.DeviceListener.HwndHandler(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

KeyPuncher commented 2 years ago

Yes very helpful, thank you.

trei49 commented 2 years ago

Just to update that for the past 5 odd months, I basically set the app to autominimize on open and literally stopped manually closing/exiting the app entirely by any method (just leave it in the tray), and only toggle Bluetooth from Win10 end to turn off wiimote when I need to.

Doing so did essentially reduce occurrence of the issue to almost nil during this time, so maybe it has to do with the app exit process itself?

Not sure if this helps confirm any suspicions on what the issue is, since win10 itself have gotten many updates as well.

KeyPuncher commented 2 years ago

I believe I fixed this, just need to draft a new release before closing it.