Unit testing fails when NOT in debug mode

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

Unit Test The adapter threw an exception: one or more of the requested types failed to load. Get the LoaderExceptions property for more information.

It’s strange that they work fine when I debug them. The error occurs when I run them without an attached debugger.

Bad fix, can someone tell me how to "get the LoaderExceptions property"?

+6
unit-testing visual-studio-2008
source share
5 answers

Try to clear the solution and try again.

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

+3
source share

I also saw this, sometimes when a simple cleanup does not help, I switch the configuration to Release, clean it, then go back to Debug, clean and restore (

+5
source share

My psychic debugger says that you are using the 64-bit version, and your test adapter is configured to use the 64-bit .NET platform, and devenv to 32-bit. Use corflags to get your test adapter to work with the 32-bit CLR.

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

+3
source share

I encountered the same errors, and the cleaning did not cope with this task.

I resolved this by going to the TestRunConfig file, in the Code Coverage menu, and placing the desired SNK file in the Re-Sign Key File text box.

I hope for this help.

+1
source share

I encountered the same problems, not in vain changing anything, so it helped me to open Configuration Manager (Build => Configuration Manager) and make sure that the solution and all its projects are installed on β€œAny processor” . Somehow, some of them were set to "x86", after you changed it to "Any processor", all tests run fine again in Debug and Release mode.

NTN

G.

+1
source share

All Articles