I have a device connected to a USB serial port which can be seen in device manager but not in registry.
When I use SerialPort.GetPortNames()
(I am expecting to return all the connected serial ports), it is not returning all the ports from the connected device.
But after re-enabling the port I can see my desired device working and it is gone after restarting the machine.
Updating the drivers didn't help.
You could use the WMI Code Creator from Microsoft to build a query for Win32_SerialPort-Devices or maybe Win32_PnPEntity.
I also got problems with the SerialPort.GetPortNames() in the past, but the Win32-classes worked just fine evertime so far.