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

This error popped up at one of the testers of our project this morning. The unittests he selected worked fine on my machine, but all failed on his with the above message. After searching a bit we found that the only thing which was different between my testrunconfig and his was that he enabled code coverage for the assembly these unittests were pounding away at. As it turns out, this error appears when code coveraging (is that even a word?) a signed assembly without re-signing it.

To re-sing an assembly, open the testrunconfig you are using and go to the ‘code-coverage’ element in the left pane. Locate the textbox ‘re-signing key file’ and enter the path to the key file which should be used to re-sign the assembly (or browse for it, of course). Hit ‘Apply’ and then hit ‘Close’. You’re done now! Happy unittesting….

re-signing key file.jpg