Reputation: 4423
An exception is being thrown at (not in) a constructor call:
controller = new Controller(classInstance); // Won't let me step in, exception thrown immediately.
The exception description is:
System.BadImageFormatException: Could not load file or assembly 'ClassLib, Version=1.0.4314.17265, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
classInstace
isn't null and I cannot step into the constructor. I have never experienced this before. Any idea what this could be?
Thanks!
Upvotes: 2
Views: 254
Reputation: 2394
Try using the Fusion Log Viewer (fuslogvw.exe) to see which assembly's being matched to ClassLib. Like Jon Skeet said, it's probably either a corrupted file, a 32 vs/ 64-bit issue, or a weird runtime mismatch.
Upvotes: 5
Reputation: 43268
It couldn't load an assembly referenced by the code in the class's constructor.
Upvotes: 1
Reputation: 1500385
Yes - it can't find the ClassLib
assembly which presumably contains Controller
- or one of its dependencies. The BadImageFormatException
suggests that maybe you've got a broken file (copy failed?) or possibly you're trying to load a .NET 4 assembly into a .NET 2 CLR. (I don't know whether that gives that exception or not, but I wouldn't be surprised.)
You haven't said what kind of project this is, but basically check all of your dependencies.
Upvotes: 4