Problem with DES in C#

Hy!

I have just bought the XEM3050 board and I am trying to access it from C#.NET (v 2.0.50727 ). For that I am trying first to compile the sample “DES”. I have added the reference to the file libFrontPanel-csharp.dll to the project and the aditional “using” directive in the source code. It compiles succesfully but when the running reaches to the constructor of the okCUsbFrontPanel object, it crashes with this error :

[COLOR=“Red”]An unhandled exception of type ‘System.TypeInitializationException’ occurred in libFrontPanel-csharp.dll

Additional information: The type initializer for ‘com.opalkelly.frontpanel.libFrontPanelPINVOKE’ threw an exception.[/COLOR]

I have never seen this type of error and I have no idea how to fix it. Can someone please help me? I would be gratefull :slight_smile:

Do you have the -pinv DLL also in the runtime directory? Keep in mind that if you’re using VS to start your program, you need to know where it sets the active directory. Typically, this is the project directory or the build directory.

Thanks alot. I was missing the -pinv dll. It was not in the directory with the sample but I found it an the API directory and followed your advice. Now it seems to work. Thanks again :slight_smile:

For reference, there is a brief section on the APIs in the FrontPanel User’s Manual (starting around page 25). The required files and proper placement is mentioned for each of the API environments.