Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit tests fail to run when NOT in Debug mode

I have just branched our Common Business Layer projects from the main to a new branch, and included them in a new solution. Everything compiles but when I run the unit tests I get the following error for every single test...

Unit Test Adapter threw exception: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

The strange thing is they run fine when I debug them. The error only happens when I run them without the debugger attached.

Failing an outright fix, can anyone tell me how to "Retrieve the LoaderExceptions property"?

like image 295
Andy McCluggage Avatar asked Dec 05 '08 11:12

Andy McCluggage


4 Answers

I've also seen this, sometimes when the simple cleanup doesn't help, I switch the configuration to Release, clean it up, then back to Debug, clean it up and rebuild (

like image 113
Max Galkin Avatar answered Nov 11 '22 04:11

Max Galkin


Try cleaning the solution and trying again.

Also try clicking on the link that appears in yellow bar of the Test Results window, this sometimes gives more information about why tests cannot be run.

like image 31
Simon Keep Avatar answered Nov 11 '22 04:11

Simon Keep


My psychic debugger says that you're using 64-bit, and your test adapter is set to use 64-bit .NET framework, and devenv is set to 32-bit. Use corflags to force your test adaptor to run using the 32-bit CLR.

NOTE: Psychic debugger is not always 100% accurate, due to its use of psychic powers :)

like image 25
Ana Betts Avatar answered Nov 11 '22 05:11

Ana Betts


I did run into the same errors and the cleaning did not do the job.

I resolved this one by going into the TestRunConfig file, Code Coverage Menu, and putting the right SNK file in the "Re-signing Key File" text box.

Hope this help.

like image 32
Karl Metivier Avatar answered Nov 11 '22 05:11

Karl Metivier