I have a .NET application utilizing the BlinkStickDotNet library, and I need to be able to react when the device is disconnected and connected. I found the UsbMonitor class has events for that (BlinkStickConnected and BlinkStickDisconnected, perfect!) but whenever the device is disconnected, a NullPointerException occurs in UsbMonitor.cs (line 100):
100 foreach (BlinkStick device in devices)
because “devices” is null. The same error occurs if I start the application (which includes a UsbMonitor object with event handlers assigned to both events) without the device connected then connect it.