-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
Milestone
Description
Description
When using IO Ports on ArchLinux System and dotnet 7.0 or 6.0 I get an exception System.PlatformNotSupportedException: System.IO.Ports is currently only supported on Windows.
SerialPort.GetPortNames() works but not SerialPort()
Reproduction Steps
- Make new console application on dotnet 6 or 7
- Add the code snippet below
- Run on different Linux systems
Expected behavior
Access to UART Serial ports
Actual behavior
Exception thrown
Regression?
No response
Known Workarounds
None so far
Configuration
Dotnet Version
╰─ dotnet --list-sdks
6.0.111 [/usr/share/dotnet/sdk]
7.0.100 [/usr/share/dotnet/sdk]
╰─ dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
OS Version, kernel
╰─ lsb_release -a
LSB Version: n/a
Distributor ID: EndeavourOS
Description: EndeavourOS Linux
Release: rolling
Codename: rolling
╰─ uname -a
Linux keelah-dellG15 6.0.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 16 Nov 2022 17:01:17 +0000 x86_64 GNU/Linux
CPU Architecture :
╰─ uname -m
x86_64
From what I've seen on the forums, it works on certain linux distros but not on others such as Manjaro and EndeavourOS (both running archlinux) and might be the same on other more obscure linux distros
Other information
A few lines of code I used on my console program :
//DEFAULT port sur /dev/ttyUSB0
string SERIALPORT = "/dev/ttyUSB0";
//Line below works
List<string> ports = SerialPort.GetPortNames().ToList();
SERIALPORT = ports.Last();
//Crash on line below
SerialPort _serialPort = new SerialPort(SERIALPORT, BAUDRATE, Parity.None, 8, StopBits.One);
_serialPort.ReadTimeout = -1; // |Pas de timeout
_serialPort.WriteTimeout = -1; // |
_serialPort.Handshake = Handshake.None;
_serialPort.DataReceived += _serialPort_DataReceived;