System.AccessViolationException using K8090Native

I’m trying to use Vellemant.Kits.dll for .NET on a Universal Window Platform application (UWP).

I cannot use the class K8090Board and its methods because it has dependencies on System.Windows.Forms which is too old for UWP (UWP is a requirement).

Therefore, I try using K8090Native static methods that call directly to the low-level API in K8090.DLL this way:

IntPtr device = Velleman.Kits.K8090Native.OpenDevice(_mupiConfig.Defibrillator.Port);



And I stumble with this error in the K8090Native.SendCommand line:

System.AccessViolationException: ‘Attempted to read or write protected memory. This is often an indication that other memory is corrupt.’

Any idea why am I getting this error? I’m trying to switch on the relay in channel 1. Connection is established succesfully.

I already checked I am running in a x86 architecture.

Thank you in advance

Well, I just saw I’m getting an Invalid handle from OpenDevice :man_facepalming:

I’m using “COM3” and I know the Relay Card is connected to that port because I’m cheking it on the demo tool.

What am I doing wrong?