-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Description
It would be good if pseudo-ttys were usable as serial ports under Linux. This does not map exactly to Microsofts .NET as ptys are not available in Windows, but there are use cases (notably connecting programs designed for serial port usage among them) where having this working would be handy.
Steps to Reproduce
On a Linux system:
- Compile the following code
using System.IO.Ports;
public class Test
{
public static void Main(string[] args)
{
SerialPort port;
port = new SerialPort();
port.PortName="/tmp/ttyA";
port.Open();
}
}
- Use
socatto open a PTY
socat PTY,rawer,link=/tmp/ttyA STDIO
- Run the testcase
Current Behavior
An exception is thrown.
Unhandled Exception:
System.IO.IOException: Invalid argument
at System.IO.Ports.SerialPortStream.ThrowIOException () [0x00012] in <a85c1a570f9a4f9f9c3d2cfa5504e34f>:0
at System.IO.Ports.SerialPortStream.SetSignal (System.IO.Ports.SerialSignal signal, System.Boolean value) [0x00042] in <a85c1a570f9a4f9f9c3d2cfa5504e34f>:0
at (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPortStream.SetSignal(System.IO.Ports.SerialSignal,bool)
at System.IO.Ports.SerialPortStream..ctor (System.String portName, System.Int32 baudRate, System.Int32 dataBits, System.IO.Ports.Parity parity, System.IO.Ports.StopBits stopBits, System.Boolean dtrEnable, System.Boolean rtsEnable, System.IO.Ports.Handshake handshake, System.Int32 readTimeout, System.Int32 writeTimeout, System.Int32 readBufferSize, System.Int32 writeBufferSize) [0x00057] in <a85c1a570f9a4f9f9c3d2cfa5504e34f>:0
at (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPortStream..ctor(string,int,int,System.IO.Ports.Parity,System.IO.Ports.StopBits,bool,bool,System.IO.Ports.Handshake,int,int,int,int)
at System.IO.Ports.SerialPort.Open () [0x00078] in <a85c1a570f9a4f9f9c3d2cfa5504e34f>:0
at (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPort.Open()
at Test.Main (System.String[] args) [0x00011] in <4d0310604e2a4f05a9aee11490ae3060>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.IOException: Invalid argument
at System.IO.Ports.SerialPortStream.ThrowIOException () [0x00012] in <a85c1a570f9a4f9f9c3d2cfa5504e34f>:0
at System.IO.Ports.SerialPortStream.SetSignal (System.IO.Ports.SerialSignal signal, System.Boolean value) [0x00042] in <a85c1a570f9a4f9f9c3d2cfa5504e34f>:0
at (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPortStream.SetSignal(System.IO.Ports.SerialSignal,bool)
at System.IO.Ports.SerialPortStream..ctor (System.String portName, System.Int32 baudRate, System.Int32 dataBits, System.IO.Ports.Parity parity, System.IO.Ports.StopBits stopBits, System.Boolean dtrEnable, System.Boolean rtsEnable, System.IO.Ports.Handshake handshake, System.Int32 readTimeout, System.Int32 writeTimeout, System.Int32 readBufferSize, System.Int32 writeBufferSize) [0x00057] in <a85c1a570f9a4f9f9c3d2cfa5504e34f>:0
at (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPortStream..ctor(string,int,int,System.IO.Ports.Parity,System.IO.Ports.StopBits,bool,bool,System.IO.Ports.Handshake,int,int,int,int)
at System.IO.Ports.SerialPort.Open () [0x00078] in <a85c1a570f9a4f9f9c3d2cfa5504e34f>:0
at (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPort.Open()
at Test.Main (System.String[] args) [0x00011] in <4d0310604e2a4f05a9aee11490ae3060>:0
Expected Behavior
Program ending without errors.
On which platforms did you notice this
[ ] macOS
[X ] Linux
[ ] Windows
Version Used:
Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-2 Wed Feb 26 23:23:50 UTC 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: supported, not enabled.
Suspend: hybrid
GC: sgen (concurrent by default)
Metadata
Metadata
Assignees
Labels
No labels