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.

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel\ v4.0_11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel.dll

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