Our application is C# .Net 4 and calls an unmanaged 32bit DLL. It's been working fine and runs many machines (mostly 64bit Windows 7). However, I recently encountered one particular user on whose machine the program traps with BadImageFormatException as soon as the call into the unmanaged DLL is made.
BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
I've done the following:
I'm nearing my wit's end. Any suggestions? Is there a particular .Net 4 update or hotfix the lack of which cause this type of issue?
The problem turns out to be some misplaced/invalid system files on the user's machine, which can manifest as "The Application was unable to start correctly (0xc000007b). Click OK to close the application" when starting certain applications.
The problem was due to 32/64-bit mismatches of various system dlls required by Visual studio. Somehow the dlls it needs got replaced by 64-bit versions that it couldn’t load.
Replacing the dlls mentioned below from a machine that is working solves the problem:
c:\Windows\SysWOW64\msvcp100.dll c:\Windows\SysWOW64\msvcp100d.dll c:\Windows\SysWOW64\msvcr100.dll c:\Windows\SysWOW64\msvcr100_clr0400.dll c:\Windows\SysWOW64\msvcr100d.dll
User contributions licensed under CC BY-SA 3.0