1

I'm developing an App in .net (Xamarin) and I'm trying to establish a connection with a serial port. Whenever I try to open the connection with the port I'm getting this error_message:

System.IO.IOException: 'Too many posts were made to a semaphore'

Can't find anything specific by googling. Any help appreciated!

Example code:

private void Open()   
    {
        IsOpen = true;
        _serialPort.PortName = "COM3";
        _serialPort.BaudRate = 19200;
        _serialPort.Parity = Parity.None;
        _serialPort.DataBits = 8;
        _serialPort.StopBits = StopBits.One;
        _serialPort.Handshake = Handshake.None;
        _serialPort?.Open();
    }
J_Ntr
  • 11
  • 2

1 Answers1

2

This is because you need to add

<DeviceCapability Name="serialcommunication">
      <Device Id="any">
          <Function Type="name:serialPort" />
      </Device>
</DeviceCapability>

to your Package.appxmanifest.

Took me awhile to figure this out myself.

ryan151
  • 21
  • 1
  • 5