我有一个包含大量单元测试的VS2012/.NET4.5解决方案。
在运行整个解决方案的所有单元测试时,我会随机地收到“QTAgent32.exe已停止工作”错误消息,导致单元测试在这一点上挂起。
我的单元测试实际上是MSTest,并且我使用VS中的Resharper菜单运行它们。 Resharper版本为7.1.3,不确定是否相关。 VS 2012 SP 3。
我有一个包含大量单元测试的VS2012/.NET4.5解决方案。
在运行整个解决方案的所有单元测试时,我会随机地收到“QTAgent32.exe已停止工作”错误消息,导致单元测试在这一点上挂起。
我的单元测试实际上是MSTest,并且我使用VS中的Resharper菜单运行它们。 Resharper版本为7.1.3,不确定是否相关。 VS 2012 SP 3。
最终我找到了原因
有一段代码编写错误,在某些情况下会导致无限递归和堆栈溢出。所以,如果你遇到相同的错误"QTAgent32.exe已停止工作",请尝试检查此时的调用堆栈。
顺便说一句:我的解决方案是在VS2012中删除解决方案目录中的TraceAndTestImpact.testsettings
文件。(也许还要删除MySolutionName.sln.DotSettings.user
并以提升的权限运行)
如果你遇到以下情况,
An exception occurred while test discoverer 'MSTestDiscoverer' was loading tests.
Exception: An error occurred while initializing the settings provider named 'MSTest'.
Error: The test settings file C:\....\TraceAndTestImpact.testsettings, specified in
the MSTestAdapter settings, is not available. Either access to the file is denied or
the file does not exist. Ensure that the test settings file is available and try again.
尝试使用提升的特权加载解决方案。更令人沮丧的是,没有创建新的TraceAndTestImpact.testsettings
文件。
ThreadPool.QueueUserWorkItem
内部使用了 Thread.Sleep
。在我重新启动电脑后,运行Visual Studio Professional 2013 Update 2时也发生了同样的情况。即使是最简单的测试在输入之前就失败了,并出现了“QTAgent32.exe已停止工作”的消息。
以管理员身份运行Visual Studio解决了我的问题。可能只是消除了症状而不是原因,但它确实起作用了。
async
测试,在assert
语句之后进行了清理。测试总是绿色的(通过),但每次执行后都会出现'QTAgent32.exe已停止工作'
错误。assert
语句之后,我调用了一个对象上的方法,该对象为null
。我认为这是由于async
测试的行为导致NullReferenceException
被吞噬了。