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"?
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.
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 (
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 :)
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.
I ran into the same problems without knowingly having changed anything, so what helped for me was to open the Configuration Manager (Build => Configuration Manager) and make sure that the solution and all its projects are set to "Any CPU". Somehow some of them were set to "x86", after changing this back to "Any CPU" all tests run fine again in Debug and Release mode.
我没有故意改变任何东西遇到了同样的问题,所以对我有帮助的是打开Configuration Manager(Build => Configuration Manager)并确保解决方案及其所有项目都设置为“Any CPU”。不知何故,其中一些被设置为“x86”,在将其更改回“Any CPU”后,所有测试在Debug和Release模式下再次运行正常。