I ran into an issue today running a unit test where I kept getting a System.BadImageFormatException on the test dll. I incorrectly assumed this was NUnit - after digging around a bit I worked out it was actuall Moq that was the source of the problem.
The return value of the object being verified existed in an assembly that was not being referenced by my test project, and Moq was falling over. Adding the reference sorted out the problem.
The exact error I encountered was:
Test.MyLongNamespace.MyTestmethod:
System.BadImageFormatException : [C:\Users\matt salmon\AppData\Local\Temp\nunit20\ShadowCopyCache\9748_634255057586445703\Tests_64256578\assembly\dl3\5181e02b\57ddb865_7585cb01\MyAssembly.DLL] The signature is incorrect.
Thanks! Just found this by Google and it saved me some time.
ReplyDeleteThank you very very much. I have just had this happen to me and this post helped me sort it out nice and quickly.
ReplyDeleteNice catch! I could not make much sense out this error.
ReplyDelete