Bad Image format exception was unhandled

0

I come across a problem that I am not able to figure out. Basically, I downloaded a sample program written in C# and I compiled it using Visual Studio community 2015.

At first, I used trial version of VS community 2015 without registering, and the program ran well. But after I registered to visual studio and get the license I have problem compiling this source code.

the error is

An unhandled exception of type 'System.BadImageFormatException' occurred in ForceFeedbackExample.exe

Additional information: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

I have tried to change the target platform as suggested by MSDN to x86 and recompile, but it turned out this error

Managed Debugging Assistant 'LoaderLock' has detected a problem in 'C:\Users\Dedy\Documents\Visual Studio 2015\Projects\forcefeedback\bin\Debug\ForceFeedbackExample.vshost.exe'.

Additional information: DLL 'C:\Windows\assembly\GAC\Microsoft.DirectX.DirectInput

does anybody know how to solve this issue?

c#
visual-studio-2015
asked on Stack Overflow Sep 10, 2015 by deduu

1 Answer

1

In Visual Studio choose the DEBUG\Exceptions menu item. Expand the Managed Debugging Assistants node and locate LoaderLock. Uncheck the Thrown box. Click OK to close the dialog then run your application again.

answered on Stack Overflow Sep 10, 2015 by Lorek

User contributions licensed under CC BY-SA 3.0