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

Crash after turning off controller #72

Closed
samusaran opened this issue Dec 15, 2022 · 2 comments
Closed

Crash after turning off controller #72

samusaran opened this issue Dec 15, 2022 · 2 comments

Comments

@samusaran
Copy link

Hi, I noticed that the application crashed after turning off the controller. Sadly I have nothing more than the event viewer entry:

Application: XB1ControllerBatteryIndicator.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: SharpDX.SharpDXException
   at SharpDX.Result.CheckError()
   at SharpDX.XInput.Controller.GetBatteryInformation(SharpDX.XInput.BatteryDeviceType)
   at XB1ControllerBatteryIndicator.SystemTrayViewModel.RefreshControllerState()
   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()
@NiyaShy
Copy link
Owner

NiyaShy commented Dec 16, 2022

Hey, is it constantly happening or did it only happen once?
Just tried it myself and it didn't crash when I turned my controller off, just returned to "no controller detected". So it could have been a rare edge case where it tried to read the battery state right as the controller disconnects.

@samusaran
Copy link
Author

samusaran commented Dec 16, 2022

It happened only once but I wanted to let you know. It could be like you said, that I turned off the controller right at the right moment. If needed, I can make you a pull request with just a try ... catch when you call GetBatteryInformation.

I don't think, looking at the code, that anything more could be done.

NiyaShy added a commit that referenced this issue Apr 21, 2023
Added try/catch to the controller polling routine to possibly prevent rare crashes (see issue #72)
@NiyaShy NiyaShy closed this as completed Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants