代码覆盖率结果定期给出:生成空结果 [英] Code Coverage Results periodically gives: Empty results generated
问题描述
我在VS2012中使用MSTest在几个不同的项目中遇到了一个反复出现的问题,在那儿我的代码覆盖时不时地停止工作(似乎是随机的),而是给了我:
I've run into a recurring problem with a few different projects using MSTest in VS2012, where every now and then my code coverage stops working (seemingly at random) and instead gives me:
生成的空结果:未检测到二进制文件.确保 运行了测试,加载了所需的二进制文件,具有匹配的符号文件, 并没有通过自定义设置排除.欲获得更多信息 请参见 http://go.microsoft.com/fwlink/?LinkID=253731
Empty results generated: No binaries were instrumented. Make sure the tests ran, required binaries were loaded, had matching symbol files, and were not excluded through custom settings. For more information see http://go.microsoft.com/fwlink/?LinkID=253731
我已经检查了明显的(建议的内容),但似乎无法弄清楚是什么原因造成的.
I've checked the obvious (what it's suggested) but can't seem to figure out what is causing it.
这是我的运行设置文件:
Here is my runsettings file:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage"
uri="datacollector://Microsoft/CodeCoverage/2.0"
assemblyQualifiedName=" Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector,
Microsoft.VisualStudio.TraceCollector,
Version=11.0.0.0,
Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a">
<Configuration>
<CodeCoverage>
<ModulePaths>
<Include>
<ModulePath>.*\.dll$</ModulePath>
</Include>
<Exclude>
<ModulePath>.*\.tests.dll</ModulePath>
</Exclude>
</ModulePaths>
<Attributes>
<Exclude>
<Attribute>.*ExcludeFromCodeCoverageAttribute$</Attribute>
<Attribute>.*GeneratedCodeAttribute$</Attribute>
</Exclude>
</Attributes>
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
<CollectFromChildProcesses>True</CollectFromChildProcesses>
<CollectAspDotNet>False</CollectAspDotNet>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
推荐答案
This link solved my issue: Issue with Code Coverage in VS 2012
关闭Visual Studio 2012,找到.suo文件,将其删除(或重命名),然后重新启动.工作正常.不知道.suo文件中的哪些内容妨碍了正确的覆盖范围分析.
Close Visual Studio 2012, find the .suo file, delete (or rename) it, restart. Worked fine. No idea what is in the .suo file that prevented proper coverage analysis.
这篇关于代码覆盖率结果定期给出:生成空结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!