Koen about .Net

January 7, 2011

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

Filed under: Development — Tags: , — koenwillemse @ 09:46

In a previous post I wrote about a problem I had with running unittests, which resulted in an exception with the message ‘Unit Test Adapter threw exception: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.’.

This morning, on my new project, I ran into the same problem after I deleted my TFS workspace locally and got everything new from the server in a different location (a new workspace). So I looked back at my previous post, tried what I wrote there, and….. still the exception :-(. To see if it would lead to more information, I started the tests in debug mode. And… all tests passed as usually. Strange…
I found the problem eventually. The assembly being tested was strongly named. Because we use the code coverage from the unittests, we had to re-sign the assembly tested after instrumentation and we set this up in the Code Coverage section in the testrunconfig.testrunconfig. Now what was the problem? The path to this key file was wrong! I made the mistake that the location pointed out there was a absolute location, instead of a relative location compared to my testrunconfig. So I changed this, cleaned my solution, rebuild the solution and ran the tests. And all tests passed again.

Another lesson learned. Whatch out that you don’t accidentally have absolute paths when referencing stuff which is located in your source control tree.

Advertisements

1 Comment »

  1. Really helpful. Thanks.

    Comment by golda972 — December 5, 2011 @ 09:29


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: