I have a .NET4 C# application with some GUI. It works with serial network devices via USB-UART converter FT2232. The converter implemets a hub with several USB, which are shown as a number of COMxx in the system.
I supported a dynamic port add/remove operation (over WMI) so as ports would refresh in UI automatically when plugged/unplugged.
Plug-in operation works fine, i.e. ports become visible in a second or two after insertion. But unpluging is the issue: when unplugged not all hub`s ports disappear, but only one or two out of four (by this time all ports are not in use, closed). The issue is valid for WinXP x86 and Win7 x64.
Some investigation showed that it does not help to refresh port list calling SerialPort.GetPortNames() after awhile or by timer. The list stays stale. BUT: if I close the window with ports (it is not the main window) and reopen it again, one phantom port disappears, then again and all phantom ports are gone!
Has anybody run into similar situations or have some ideas?
May it be somehow connected with that I call GetPortNames from UI context?
Or this is rather HW driver issue?