I am trying to open COM1, but get a strange error every time I call SerialPort.Open()
.
The error is:
The given port name does not start with COM/com or does not resolve to a valid serial port. Parameter name: portName
The code is very simple:
SerialPort port = new SerialPort("COM1", 19200, Parity.None, 8, StopBits.One);
port.Handshake = Handshake.RequestToSend;
port.Open();
If I call SerialPort.GetPortNames()
, it returns one port called "COM1".
I've verified that I have a "COM1" on my computer, and I'm not using it in any other applications. When I run the code on another computer, it works. My system is running Windows Vista. The version of .NET is 2.0.
Is there a security setting I have to change somewhere? I'm logged in as an admin, and have UAC turned off.
More info
I used Process Explorer and confirmed that nothing is using \Device\Serial0.
Workaround
I installed a USB-Serial adaptor (COM3), and it works fine. Go figure. There must be a problem with COM1.