Using VS 2005 / .NET 2.0 SP2
An IOException of "The device does not recognize the command" is generated when my application exits after a USB device is unplugged. Using a USB device driver which presents the device as a COM port when it is connected. My
application uses System.IO.Ports.SerialPort to communicate with the device.
When the device is plugged into the USB port, it registers as connected to the COMx correctly. I start my application which enumerates through all of the COM ports looking for my device. The application correctly locates the
device and starts communicating with it. This is all done using SerialPort methods (i.e. Open, ReadLine, ...)
If I disconnect the device from the USB port while my application is running, of course the virtual COMx port is now gone (device manager shows the COM port is gone) . My program senses that the device connected to the COM port is no
longer responding (it has been polling it for information), it closes the COM port and displays a MessageBox to relate the condition and exits the application when the user presses OK.
Here is the odd part, the IOException occurs after leaving Main(). What am I missing in regards to this being a USB device (which is a seria
View Complete Post