takuya-takeuchi / FaceRecognitionDotNet

The world's simplest facial recognition api for .NET on Windows, MacOS and Linux
MIT License
1.26k stars 308 forks source link

Error DlibDotNet.NativeMethods. #193

Closed SenyniumX closed 2 years ago

SenyniumX commented 2 years ago

I am trying to use FRDN and receive the following exception

System.TypeInitializationException: The type initializer for 'DlibDotNet.NativeMethods' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at DlibDotNet.NativeMethods.LossMetric_anet_type_create() at DlibDotNet.NativeMethods..cctor() --- End of inner exception stack trace ---

My environnement is as folow

Windows Server 2019 x64 Processor Intel Core I9 9900K CPU DotLibDotNet v 19.21.0.20210302 FRDN v 1.3.0.5 Visual C++ 2015-2019 Redistributable

On my development environment, it works perfectly

Can you help please ?

takuya-takeuchi commented 2 years ago

@SenyniumX Please check C# project configuration. I think your project file uses 'Prefer 32bit'. https://stackoverflow.com/questions/12066638/what-is-the-purpose-of-the-prefer-32-bit-setting-in-visual-studio-and-how-does

SenyniumX commented 2 years ago

It works now. You save my day, Thanks a lot