Is the port open?
Have you added an event handler? (port.DataReceived+=....)
Are you using the right port?
Is the connected device transmitting?
Does DTR and/or RTS need to be enabled?
Are you using the correct baudrate, parity and stopbit settings?
Perhaps the connected device needs to receive a command in order for it to start transmitting?
I have exactly the same problem in Vista X64 (and maybe X86 but I don't have that setup available).
I have code that runs fine under XP Pro, I see events for the data being received, and my app generally runs OK.
If I move the same executable to Vista then I no longer see and receiveData events triggered.
The serial port is a virtual one from a USB device and the driver is the very latest version of the Silicon Labs CP210X USB to UART Bridge (ver 5.2.2) driver.
Any help appreciated.
I exactly have the same issue with vista 64 and a iogear usb to serial adapter GUC232A.Using the same c# code on VS2005, Datareceived events get fired on a XP machine but not on my vista 64 machine. Did you have a chance to figure it out? FYI, I have tried with 3 different usb to serial adapters and same all...
I had similar issues. It worked perfectly on my local box, but failed on a bunch of test machines. I run Vista x64, whilst most of the test machines were a combination of WinXP and Vista 32. I was attempting to communicate to a GSM modem.
We had (prior to .Net 2.0) been using some code that was doing all the low level hard work via unmanaged Win32 calls. Converting to the SerialPort class in .Net 2.0 killed off a heap of code which I was happy not to have to maintain, but establishing a good serial connection seemed flakey at best using the SerialPort class.
In the end I found the following:
1. This article on CodeProject was useful: http://www.codeproject.com/KB/dotnet/NET_20_SerialPort.aspx. As it seemed to be the DataReceived event, I recoded it to have a polling based approach (made me shudder cause I generally try to avoid this) using the ReadByte method, adding each character received to a buffer. However, as I send a request and wait for a response I would only poll in a relatively tight loop immediately after sending the request.
2. Found that the Write method would hang on machines running VMware even with no VM's running. In addition, on other machines, if I ran Hyperterminal, closed it, then tried to run my program immediately after, it would also hang. For some reason the COM port seems to be captured and unable to be re-captured by the SerialPort class in circumstances like this. We still haven't got to a satisfactory conclusion on this.
I'm not convinced I much wiser after this episode, and would appreciate any further feedback.