sillsdev / chorus

End-user collaboration library via 3-way xml merging and hg dvcs under the hood
6 stars 26 forks source link

exception handling around GetDrives()? #261

Open bobeaton opened 3 years ago

bobeaton commented 3 years ago

Some of the users of Chorus in OSE get the below exception stack (green screen of death). I think in the past it was when maybe they had something plugged into a USB port... Is it possible to add exception catching if GetDrives() fails?

Msg: Invalid class 
Class: System.Management.ManagementException
Source: System.Management
Assembly: System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Stack:    at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
   at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
   at SIL.UsbDrive.Windows.UsbDriveInfoWindows.GetDrives() in C:\BuildAgent\work\a868e9f1d5fee9d4\SIL.Core.Desktop\UsbDrive\Windows\UsbDriveInfoWindows.cs:line 69
   at SIL.UsbDrive.UsbDriveInfo.GetDrives() in C:\BuildAgent\work\a868e9f1d5fee9d4\SIL.Core.Desktop\UsbDrive\UsbDriveInfo.cs:line 112
   at Chorus.UI.UsbDriveLocator.ScanForUsbDrives()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
Thread: 
Thread UI culture: en-US
Exception: System.Management.ManagementException

--Error Reporting Properties--
Version: Version 4.2.7 (apparent build date: 30-Mar-2021)
CommandLine: "C:\Program Files (x86)\SIL\OneStory Editor\StoryEditor.exe" 
CurrentDirectory: C:\Program Files (x86)\SIL\OneStory Editor
MachineName: ARIKA
OSVersion: Windows 10 
DotNetVersion: 4.0.30319.42000
WorkingSet: 25501696
UserDomainName: ARIKA
UserName: Admin
Culture: en-US
KeyboardAdaptors: WinKeyboardAdaptor

--Log--
Thursday, September 2, 2021
9:09:45 AM  App Launched with ["C:\Program Files (x86)\SIL\OneStory Editor\StoryEditor.exe" ]
9:09:46 AM  Keyboard adaptors in use: WinKeyboardAdaptor
9:09:47 AM  Exception: Invalid class 
Details of most recent events:
9:09:45 AM  App Launched with ["C:\Program Files (x86)\SIL\OneStory Editor\StoryEditor.exe" ]
9:09:46 AM  Keyboard adaptors in use: WinKeyboardAdaptor
9:09:47 AM  Exception: Invalid class 

To Reproduce: