In case you are upgrading VS from the developer preview build to VS 11 beta, then there is a chance that you can face a problem while running tests from unit test explorer. The symptoms of the problem are that the tests will not get run and you will observe the following error in the VS output window.
An exception occurred while test discoverer 'MSTestDiscoverer' was loading tests. Exception: Attempt by method 'Microsoft.VisualStudio.TestPlatform.Extensions.TmiHelper.TmiRequest.CreateTestRunConfiguration()' to access field 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement.TestTypeInstance' failed.
This error occurs because of the presence of a stale binary on the machine that does not get removed on uninstall of the developer preview build. To resolve this error, please do the following steps.
- Check that the following binary on your machine exists. If it does not exist, then the resolution mentioned below is not applicable for your machine.
- Close all instances of visual studio (and stop test controller and/or test agent services if they are also present).
- Open an administrator command prompt.
- Take a backup of the above assembly and then delete it.
- Now launch visual studio and try to run the tests. It should work.