I've recently come across this problem. The software developed in my company does an heavy use of System.IO.Ports.SerialPort for COM port connections. We have now a new embedded PC we're working on, and, when i try to do SerialPort.Open() it throws an exception saying "The data area passed to a system call is too small".
After various tests i found out that other softwares (eg Terminal2, Hercules) can succesfully open said COM port with the same configuration (Baud Rate, Parity, etc), send and receive data, so i think that there's something wrong with the .net Framework's SerialPort implementation (nothing new under the sun).
In device manager these ports are listed as "UartSub Device (COMX)", and the location is Intel(R) Serial IO UART Host Controller. This is at the moment the only difference with the previous system (where SerialPort works fine) i can tell.
Any advice?
EDIT - Adding code snippet for clarity.
SerialPort SP = new SerialPort(CmbPorts.Text.ToString().Trim(),
115200, Parity.None, 8, StopBits.One);
SP.Handshake = Handshake.None;
SP.Open();
This is the StackTrace:
at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
at TestUartCOMPort.Form1.BtnConnect_Click(Object sender, EventArgs e) in C:\Workspace\Projects\TestUartCOMPort\TestUartCOMPort\Form1.cs:line 49