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); Velleman.Kits.K8090Native.SendCommand( device, Convert.ToByte(Velleman.Kits.K8090Command.SwitchRelayOn), Convert.ToByte(0x1),//_mupiConfig.Defibrillator.Channel Convert.ToByte(0x0), Convert.ToByte(0x0) ); Velleman.Kits.K8090Native.CloseDevice(device);
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