The type initializer for ‘Leap.LeapPINVOKE’ threw an exception.

If you are developing with the Leap Motion and get the exception: “The type initializer for ‘Leap.LeapPINVOKE’ threw an exception.”, than you

  • have not added all *.dll files from the “/LeapSDK/lib/[x86 or x64]/” directory to the debug folder of your C# project
  • have added the wrong .dll files. For Example: If you have copied all the x64 dll files, but Visual Studio compiles the project in the x86 architecture, you also get this exception.

The solution is to simply copy all these *.dll files to “…/<YourProject>/bin/Debug/” resp. to change the x64 dll files with the x86 dll files (or vice versa).

3 thoughts on “The type initializer for ‘Leap.LeapPINVOKE’ threw an exception.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>