Menu

#47 Device property of WinUsbRegistry tries to open the device whenever retrieved

v2.2.8
open
nobody
5
2014-12-11
2014-12-11
Jay
No

The Device property of WinUsbRegistry attempts to open the device and return it whenever the property is retrieved. However, the device can only be opened once, so any future retrievals of the property will attempt to open the same device -- this fails, and returns a null device to the caller. The code should be changed to the following:

WinUsbDevice winUsbDevice = null;

public override UsbDevice Device

{

get

{

if(winUsbDevice == null)

Open(out winUsbDevice);

return winUsbDevice;

}

}

Discussion


Log in to post a comment.