MobiFlight-Connector icon indicating copy to clipboard operation
MobiFlight-Connector copied to clipboard

Crash in DeviceMonitor

Open neilenns opened this issue 5 months ago • 11 comments

Reported by a user in Discord

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.

neilenns avatar Jan 16 '24 15:01 neilenns

@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.

neilenns avatar Jan 16 '24 15:01 neilenns

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

Koseng avatar Jan 16 '24 18:01 Koseng

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.

neilenns avatar Jan 16 '24 19:01 neilenns

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 avatar Jan 16 '24 19:01 Koseng

@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 avatar Jan 16 '24 21:01 neilenns

@neilenns cool. Ok let's do something like that and an additional messagebox would be nice I think.

Koseng avatar Jan 16 '24 22:01 Koseng

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

neilenns avatar Jan 16 '24 23:01 neilenns

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.

DocMoebiuz avatar Feb 02 '24 08:02 DocMoebiuz

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.

neilenns avatar Apr 06 '24 11:04 neilenns

Confirmed it was the same problem even though the exception was different and running the repair command fixed it.

neilenns avatar Apr 06 '24 11:04 neilenns