Misdirection. Sometimes it's not actually a .NET problem:
If you're using Mono's
System.IO.Ports.SerialPort on Linux,
and you're getting the System.IO.IOException
"Invalid
argument", it might not actually be the class library
implementation. Check your serial adapter (assuming you're
using a USB-to-serial adapter...) I'm using an adapter with
the MosChip 7720 chipset:
usbcore: registered new interface driver usbserial USB Serial support registered for generic usbcore: registered new interface driver usbserial_generic usbserial: USB Serial Driver core USB Serial support registered for Moschip 2 port adapter mos7720: 1.0.0.4F:Moschip USB Serial Driver moschip7720 2-1:1.0: Moschip 2 port adapter converter detected usb 2-1: Moschip 2 port adapter converter now attached to ttyUSB0 usb 2-1: Moschip 2 port adapter converter now attached to ttyUSB1 usbcore: registered new interface driver moschip7720
When opening the serial port,
System.IO.Ports.SerialPort indirectly calls
SetSignal, which calls the TIOCMGET
ioctl,
which, as it happens, ISN'T IMPLEMENTED in the
mos7720 driver! Harumph.
There's a patch, signed off by both Alan Cox and Greg Kroah-Hartman, but it doesn't seem to be in the upstream, yet.
Patch: Fix the tiocmget/mset handling on the mos7720 USB serial port.
