Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BadImageFormatException when using FindAll or FindByTransport #65

Closed
Multi-Coder-24 opened this issue Feb 9, 2024 · 5 comments · Fixed by #154
Closed

BadImageFormatException when using FindAll or FindByTransport #65

Multi-Coder-24 opened this issue Feb 9, 2024 · 5 comments · Fixed by #154

Comments

@Multi-Coder-24
Copy link

Every time I attempt to call either FindAll or FindByTransport I get the following exception,
System.BadImageFormatException
HResult=0x8007000B
Message=An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
Source=Yubico.Core

Stacktrace: https://gist.github.com/DDX5/71488b1f4e4f0a49d1b5c8bd13a6b9d3

@Multi-Coder-24
Copy link
Author

To provide some clarity and to assist in possible debugging steps. I am using the Nuget package version 1.9.1
When I connect using TryGetYubiKey and pass the serial number, it works and returns the YubiKeyDevice.

@GregDomzalski
Copy link
Contributor

Hi, can you please provider the .NET version, Operating System, and Processor Architecture you're encountering this error with?

The exception is usually seen when there's a runtime mismatch between our native platform library Yubico.NativeShims.dll and the managed process's runtime identifier. (i.e. 32-bit DLL loading into 64-bit process or vice versa). This should be automatically handled by NuGet and MSBuild, but it doesn't always get it correct.

@Multi-Coder-24
Copy link
Author

I am using .NET framework version 4.8, Windows 11 pro and running Zen 3 64 bit architecture.

@Multi-Coder-24
Copy link
Author

I have managed to find out the error, by default visual studio and windows forms has an option called prefer 32 bit. When you mentioned about 32 bit trying to load into 64 bit and vice versa I deselected the option and It has fixed the error. May I suggest that you or someone in charge of the sdk docs put a note on there that highlights this problem

@DennisDyallo
Copy link
Collaborator

These should be fixed now @Multi-Coder-24 , please get back to me if you run into any issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants