dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.9k stars 4.63k forks source link

SerialPort.GetPortNames() throws a PlatformNotSupportedException in UWP ARM platforms #67461

Open gmgallo opened 5 years ago

gmgallo commented 5 years ago

System.PlatformNotSupportedException: 'Enumeration of serial port names is not supported on the current platform.' .NET Core also has a Windows.Devices.SerialCommunication.SerialDevice() class, which lacks a port enumeration function. A clarification is needed to know if SerialDevice() is deprecated in favor of SerialPort() but kept for backward compatibility with older code.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

misaya commented 2 years ago

did this issue solved?

misaya commented 2 years ago

The SerialDevice class was suggested in UWP.

jozkee commented 2 years ago

cc @krwq @wfurt

trantamcdt92 commented 2 years ago

I also encountered this issue on MacOS (12.0), is there a way to fix this issue?

gmgallo commented 1 year ago

I ended up writing my own serial port enumeration lib using Win32 system calls. Unfortunately I know nothing about MacOS. You will have to write your own. Sorry. Be aware that the NET SerialPort module also has problems. Under heavy data streams it randomly misplaces a bunch of bytes out of order specially at the start of the stream. I also ended up writing my own C++ lib with native system calls to avoid it. There is ample discussion about this problem in StackOverflow.