Serial Connection DUT


I’m looking into using OpenTap for our company. I’m busy developing some basic (fake) tests. The device will have firmware on it which can receive test commands via a serial connection. Now, i’m trying to open a serial connection, but I can’t get it to work.

The code looks like this:


The error message looks like this:

Does anyone have any idea why this doesn’t work? Or is there an example somewhere to create a serial connection? (Windows, C#)

Kind regards,


Hi @oscarkro,

The problem is that you are using a System.IO.Ports DLL with an unspecified OS. This will cause it to select a generic / “cross platform” one, which is not implemented.

The easiest solution is to build for .NET framework instead of .netstandard, but you might also be able to specify RuntimeIdentifier as targeting e.g win10.


Just corroborating what @rolf_madsen said, over here we build for .NET framework and successfully use the SerialPort class. Our code looks very similar to that shown by @oscarkro. Although I don’t see _serialPort.Open() called, which I think will be necessary at some point.

I’m assuming the error gets thrown on this line:
_serialPort = new SerialPort();

1 Like

Hi Everyone, sorry for the late responds. I’ll get back to it later. Daughter needs to go to the hospital so it’s a busy week. To be continued

1 Like

@oscarkro Take care and I hope your daughter gets well soon.

1 Like

Hi everyone. Thanks again for all the replies. It is fixed by setting the runtime identifier to the correct Windows.

Thank you all