Skip to content

Linux: System.IO.Ports.SerialPort does not open with baudrate 111,865 #80288

@DJSures

Description

@DJSures

area-System.IO

Description

We migrated a working console application from .Net 4.7.2 to .Net 7. The System.IO.Port.SerialPort gives an error with .Net 7 for the baud rate of 111,865. It works on Windows and macOS but does not work on Linux (x64, ARM64, ARM) anymore since the migration from .net 4.7.2 to .net 6. The error "Value does not fall within the expected range" is raised.

       var _sp = new SerialPort(
          "/dev/ttyS0",
          111865,
          0,
          8,
          StopBits.Two,
          Handshake.RequestToSend);
        _sp.Open();

Reproduction Steps

Attempt to open the serial port with the following on Linux

       var _sp = new SerialPort(
          "/dev/ttyS0",
          111865,
          0,
          8,
          StopBits.Two,
          Handshake.RequestToSend);
        _sp.Open();

Expected behavior

No error is thrown, and it works like all .Net Framework did (i.e. 4.7.2)

Actual behavior

An exception is raised for "Value does not fall within the expected range"

Regression?

.Net Framework 4.7.2

Known Workarounds

No response

Configuration

.net 7

Linux (ARM64, ARM, x64)

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions