blog community
Solving System.Reflection.ReflectionTypeLoadException with VSTS Unit Testing

Recently VSTS kept throwing the following exception at me

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..

The weird thing was that debugging a test would work, but simply running it would not. 

After some searching it turned out that a drive containing the external assembly which it complained about was not available, although compilation did just work.. probably because of copy-local.

I experimented some more and found that the easiest way to detect the assembly is to first perform a "Clean solution" in Visual Studio and then perform a "Rebuild All". This way, all dependencies wil be re-checked with compilation, and the compiler will simply complain about the missing assembly. Of course you could also use fuslogvw.exe, but I think this solution is often easier.

[Update 11-04-2008]: I found that when the above does not works, switching to Debug mode, Running tests and switching back to relase mode can help


Posted 06-11-2006 10:18 by Raimondb

Comments

Vaibhav wrote re: Solving System.Reflection.ReflectionTypeLoadException with VSTS Unit Testing
on 08-02-2008 22:30

This is of NO USE....

pratap wrote re: Solving System.Reflection.ReflectionTypeLoadException with VSTS Unit Testing
on 10-04-2008 11:58

for my case, even in the 'Debug' mode test method does not run successfully and same error is thrown. i tried ur advice but it seems not working here

Maverickcoder wrote re: Solving System.Reflection.ReflectionTypeLoadException with VSTS Unit Testing
on 17-10-2008 13:20

I had similar problem while running my application in a system that had no Directx runtime. I downloaded and installed directx_aug2008_redist.exe. Then it was all fine. Hope this helps someone of you.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Enter code (required)
Powered by Community Server (Commercial Edition), by Telligent Systems