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:
- Select “Test” > “Edit Test Run Configurations”
- Choose the appropriate testrunconfig
- Select the “Code Coverage” section.
- Make sure the “Re-signing key file” is populated with the key file used to sign your assembly.