MobiFlight-Connector
MobiFlight-Connector copied to clipboard
Crash in DeviceMonitor
Version: 10.1.0
Crashes with an unhandled exception on startup:
************** Exception Text **************
System.Management.ManagementException: Недопустимый класс
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementEventWatcher.Start()
at MobiFlight.Monitors.DeviceMonitor.<Start>d__14.MoveNext()
The exception error translates to Invalid Class
.
@Koseng looks like you did this change in 10.1. Not sure why it would be crashing, but at a minimum needs some try/catch I guess.
Advised to user: What i found is maybe your windows wmi repository is corrupted. That might explain why windows was not able to detect the arduino any more and leads to that exception.
Please try: https://www.thewindowsclub.com/how-to-repair-or-rebuild-the-wmi-repository-on-windows-10
I had someone with wmi corruption issues when I did the original port detection work, forgot about that.
We should try/catch this and log an error so we don't crash. I think at one point I even added a warning this might be the cause? I'll go back and look.
Ok the link helped. Problem is resolved. If we now know the reason, we could keep the exception. Or better catch the exception and show a box with the probable problem. Only logging I don't like. I like, if there is a real problem that it actively shows.
@Koseng I fixed essentially this same bug a year ago, see https://github.com/MobiFlight/MobiFlight-Connector/pull/1126/files?diff=unified&w=1 for the fix and the logged message we went with.
@neilenns cool. Ok let's do something like that and an additional messagebox would be nice I think.
I think message box is too much work for a case we've only seen twice in a year, especially if it can happen any time the background process runs 😅 But I'll leave it up to @DocMoebiuz
I think this is a pretty fundamental issue which would prevent Mobiflight from working with any kind of device. So basically continuing with Mobiflight doesn't make sense.
For such an important error I think it would be beneficial for the user to know what to do next. Not everyone will understand that they should check their log.
At least a general "check your log for more information" should be presented to the user. The specific resolution can then be seen in the log message.
We need to get this old code added back in. I'm pretty sure another user is hitting a crash related to this in Discord. We don't need fancy dialogs, just get the try/catch in with a logged error so we don't crash.
Confirmed it was the same problem even though the exception was different and running the repair command fixed it.