VS 2012 中的代码覆盖问题 [英] Issue with Code Coverage in VS 2012

查看:25
本文介绍了VS 2012 中的代码覆盖问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 3 个简单测试的简单 ASP.Net MVC 4 应用程序.

I have a simple ASP.Net MVC 4 application with 3 simple tests.

这些测试中的每一个都成功运行到完成,但是代码覆盖率窗口给了我以下错误:

Each of these tests run successfully to completion, however the Code Coverage window gives me the following error:

生成空结果:未检测二进制文件.确保测试运行,加载了所需的二进制文件,具有匹配的符号文件,并且没有通过自定义设置排除在外.有关详细信息,请参阅 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 have done some research but nothing has resolved my problem to date.

  • 我知道测试运行
  • 我在与 .dll 相同的位置有 .pdb 文件
  • 我不是通过代码优化
  • 我找不到任何 .testsettings 文件
  • 我也以管理员身份运行了我的 VS 2012 Ultimate,但没有运气.

如果我找到了 .coverage 文件,那么里面只有:

If I find the .coverage file, all it has in it is:

PCHÿ

不是我期望的 xmls 结果或错误消息.

Not the xmls results or error message I am expecting.

推荐答案

我意识到这已经一年多了.尽管如此,我刚刚遇到了完全相同的问题,甚至到 .coverage 文件中的PCHÿ"文本,并且直到现在还没有找到解决方案.但肯定其他人也遇到了这个问题,以防万一,这里有一个简单的解决方案:

I realise this is over a year old. Nevertheless I have just encountered exactly the same issue, even down to the "PCHÿ" text in the .coverage file and have found no solution up 'til now. But surely someone else has had the issue too so, just in case, here's the simple solution:

检查这个MSDN 链接 并按照其建议我仍然遇到同样的问题.所以,最后,我关闭了 VS,转到根解决方案目录并删除 .suo 文件.它设置了隐藏属性,因此您可能需要设置资源管理器以显示隐藏文件.

After checking this MSDN link and following its advice I still had the same issue. So, in the end, I shutdown VS, went to the root solution directory and deleted the .suo file. It has the hidden attribute set so you might need to set explorer to show hidden files.

重新启动 VS 并重新运行代码覆盖率测试.一切顺利.

Restart VS and re-run the code coverage tests. All fine.

这篇关于VS 2012 中的代码覆盖问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆