将我的解决方案转换为Visual Studio 2012后,为什么de testrunner崩溃了?

时间:2013-03-13 14:02:15

标签: visual-studio-2010 visual-studio-2012 mstest

我将解决方案转换为Visual Studio 2012(之前的版本是Visual Studio 2010)后,我尝试在解决方案中运行单元测试。现在,testrunner在执行单个测试之前崩溃了。我得到一个相当普遍的错误消息。如果我选择调试Visual Studio,我会得到以下堆栈跟踪:

Microsoft.VisualStudio.QualityTools.TMI.dll!Microsoft.VisualStudio.TestTools.TestManagement.AssemblyKeyExtractor.ExtractPublicKeyFromKeyFile(string keyFile, out bool isPublicKey)
[Managed to Native Transition]
Microsoft.VisualStudio.QualityTools.TMI.dll!Microsoft.VisualStudio.TestTools.TestManagement.PublicKeyHolder.this[string].get(string file)
Microsoft.VisualStudio.QualityTools.TMI.dll!Microsoft.VisualStudio.TestTools.TestManagement.DeploymentHelper.GetPublicKey(string keyFile, Microsoft.VisualStudio.TestTools.TestManagement.PublicKeyHolder publicKeyHolder)
Microsoft.VisualStudio.QualityTools.TMI.dll!Microsoft.VisualStudio.TestTools.TestManagement.DeploymentHelper.ProcessCodeCoverageItemsForDeployment(System.Collections.Generic.List<Microsoft.VisualStudio.TestTools.TestManagement.DeploymentCoverageItem> deploymentCoverageItems)
Microsoft.VisualStudio.QualityTools.TMI.dll!Microsoft.VisualStudio.TestTools.TestManagement.DeploymentManager.DoDeployment(Microsoft.VisualStudio.TestTools.Common.TestRun run, Microsoft.VisualStudio.TestTools.Common.FileCopyService fileCopyService)
Microsoft.VisualStudio.QualityTools.TMI.dll!Microsoft.VisualStudio.TestTools.TestManagement.ControllerProxy.SetupTestRun(Microsoft.VisualStudio.TestTools.Common.TestRun run, bool isNewTestRun, Microsoft.VisualStudio.TestTools.Common.FileCopyService fileCopyService, Microsoft.VisualStudio.TestTools.TestManagement.DeploymentManager deploymentManager)
Microsoft.VisualStudio.QualityTools.TMI.dll!Microsoft.VisualStudio.TestTools.TestManagement.ControllerProxy.SetupRunAndListener(Microsoft.VisualStudio.TestTools.Common.TestRun run, Microsoft.VisualStudio.TestTools.Common.FileCopyService fileCopyService, Microsoft.VisualStudio.TestTools.TestManagement.DeploymentManager deploymentManager)
Microsoft.VisualStudio.QualityTools.TMI.dll!Microsoft.VisualStudio.TestTools.TestManagement.ControllerProxy.QueueTestRunWorker(object state)
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(object state)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
[Native to Managed Transition]

堆栈跟踪表明我正在测试签名程序集的事实可能会触发错误。

1 个答案:

答案 0 :(得分:0)

经过一些实验,我发现我可以通过在测试运行配置文件中禁用测试运行的代码覆盖率来解决此问题。您可以通过打开LocalTestRun.testrunco​​nfig文件(位于解决方案项下) - &gt;来执行此操作。然后,数据和诊断将禁用“代码覆盖率”(Visual Studio 2010)&#39;