Saturday, June 25, 2011

Unit tests fail after enabling Code Coverage

If you add an assembly for code coverage analysis and your unit tests start to fail, then it is probably caused by the following exception:

System.Security.SecurityException: Strong name validation failed.

To fix this issue, in Visual Studio, do the following:
  1. Select “Test” > “Edit Test Run Configurations”
  2. Choose the appropriate testrunconfig
  3. Select the “Code Coverage” section.
  4.  Make sure the “Re-signing key file” is populated with the key file used to sign your assembly.

No comments:

Post a Comment