The version I am using is: Opal Kelly Board API Version 5.0.2
I am using the following two DLL’s: libFrontPanel-csharp.dll and libFrontPanel-pinv.dll
My project builds, runs and powers on. But if I try to power cycle the power supply that is powering the board the entire app crashes. The power supply was tested without the opal kelly board attached and it power cycles fine without crashing the app. However, with that test we did have a acroname hub hooked up (with devices attached) to test it, and when those devices disconnect the app stays running. Calling close, dispose on the it does not seem to help. I have placed try catches around calls, check for error codes (including NoError) but it still crashes.
The only error catching I can get is from the Windows Event Viewer which has the following information in it:
OS Name|Microsoft Windows 10 Enterprise|
Version|10.0.19044 Build 19044|
System Type x64-based PC
Side note: I was wondering why in the documentation it mentions a Monitor class but this is unavailable to C# it seems it wasn’t brought over is this correct?
I also did search for similar issues but none them helped me since they were issues like not having both dlls in place, or in the right spot. (I would upload an image but I can’t as I am newb).
I did read this one: Front Panel DLL Crash and others.
Yes, I am aware it is not the newest build but I will have to get permission to do this because we are required to stay in sync with production, but I should be able to test in a solo environment maybe. My lead will have to evaluate risk vs reward for updating all of our systems.
So, I finally managed to try this, but I am still having issues.
The first attempt I tried adding it directly to my project and just replace the old version DLL’s, that failed with PINVOKE error. The second attempt I made an empty project and the only thing it is a call to the opal kelly dll. Which I have placed the files in the following locations.
I get the following error:
System.TypeInitializationException: ‘The type initializer for ‘OpalKelly.FrontPanel.libFrontPanelPINVOKE’ threw an exception.’
DllNotFoundException: Unable to load DLL ‘libFrontPanel-pinv’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
The okFrontPanel.dll and libFrontPanel-pinv.dll files need to be in the runtime directory of your application (C:\throwAway\opkel_throwaway\ThrowAwayConsoleApp1\bin\x64\Debug). I was able to recreate your error message using the DESTester Sample provided in the FrontPanel install. I added the csharp library as a reference but did not add the okFrontPanel.dll and libFrontPanel-pinv.dll files to the \x64\Debug directory and received the same error.
Yeah, as I said above I added them to those directories specified in the api. So, you are able to reproduce my problem by leaving those files out of those directories, but what happens when you copy them into it? Does it run and work? Because for me no matter where I place them it does not work. It says its missing a manifest if I try and load the dll manually.
I also tried registering into the GAC using the util and it fails as well but I am not the most experienced with GACUTIL.
gacutil /i 'C:\Program Files\Opal Kelly\FrontPanelUSB\API\Csharp\x64\libFrontPanel-pinv.dll'
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.
Failure adding assembly to the cache: The module was expected to contain an assembly manifest.