Welcome Guest! To enable all features please Login or Register.



Bad Image Format Exception Thrown When Target CPU Settings Don't Match
#1 Posted : Friday, September 6, 2019 7:20:07 AM(UTC)
Rank: Member

Groups: Registered
Joined: 9/3/2014(UTC)
Posts: 13
Location: Australia

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Hi Remco and team,
I run into a situation with Ncrunch today where it failed all my tests in a project with a Bad Image Format Exception but VS was happy and compiled and run my application with out a problem.

In my solution (VB) I have my source code and there tests separated into different projects, if you set, from the solution explorer, [PROJECT NAME]->My Project->Compile->Target Cpu differently in both projects Ncrunch fails all the tests in the project with a Bad Image Format exception.

In my case I had specifically set my source code project to compile for X64 but had inadvertently left the project containing the tests to the default Any Cpu setting.

Expected: No Exception to be thrown
But was: <System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\...\AppData\Local\NCrunch\12860\34\Core\bin\Debug\Core.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Just wondered if this was a bug?

Thanks for your help.
#2 Posted : Friday, September 6, 2019 12:32:35 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,090

Thanks: 792 times
Was thanked: 1036 time(s) in 986 post(s)
Hi, thanks for posting.

This is by design. See here for more information about these sorts of problems. It's always possible to resolve these problems using a corrected solution structure or configuration.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.023 seconds.