VS2010 中的代码覆盖率停止工作 - 大概是在安装 PEX 之后

发布于 2025-01-05 06:36:33 字数 3211 浏览 3 评论 0原文

我已经设法使用我的解决方案之一在 VS2010 Premium 中获得代码覆盖率。结果出来了,一切都很好。这是前一段时间的事了。

与此同时,我已经安装了 PEX & Moles 并尝试使用这些工具,即完成了一些教程等。现在,如果我尝试使用相同的测试设置来计算代码覆盖率,我会收到以下消息:

代码覆盖率分析引擎抛出异常: 无法加载 DLL“Microsoft.VisualStudio.Coverage.Symbols.dll”。找不到程序。

(HRESULT 异常:0x8007007F)

(“找不到过程”是我对本地化文本的翻译)。

我尝试将 VS2010 抱怨的 DLL 文件包含为部署项,并且我还可以看到它们显示在测试部署文件夹中。然而,这并没有解决任何问题。

无论我尝试计算哪个项目的代码覆盖率,这都是一个一致的错误。我怀疑 PEX/Moles 是罪魁祸首,因为我在安装 pex 之前就让它工作了,现在代码覆盖率不再在 VS2010 IDE 中工作。当然可能还有其他原因,但我还没有安装那么多其他扩展。另外,代码覆盖率工作和不工作之间的时间间隔或多或少与我安装 PEX 的时间间隔一致。

这可能与存储在某处的某些用户设置有关吗?我注意到在重新安装 IDE 后,我所有的旧设置都神奇地就位了。难道我需要删除某个地方的东西吗?

也许我还应该声明我在本地检测我的程序集。不涉及团队站点或 TFS 服务器。

在寻找解决方案时,我找到了以下链接,但它们似乎都与我的问题没有直接相关:

上面的最后一个链接指出应该保留 Microsoft。 VisualStudio.Coverage.Symbols.dll 和 Microsoft.VisualStudio.Coverage.Analysis.dll 文件位于同一位置。两者都位于我的计算机上的以下位置:

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies

我的计算机实际上是 64 位计算机,但是上述文件位于 32 位位置。这可能是原因吗?

感谢您为解决此问题提供的任何帮助(这可能与 PEX 根本无关!)

编辑 2012-02-16:我能够运行我的测试,并且我也得到了数据在相关位置生成的.coverage 文件。但是,在资源管理器中双击 data.coverage 文件并尝试在 VS2010(代码覆盖率结果窗口)中展开它时,我收到以下错误消息:

代码覆盖率分析引擎抛出异常:

找不到图像文件“我想要检测的 dll 文件的名称”?

如果我查看测试结果的 out 文件夹,我可以看到上面错误消息中提到的 DLL 实际上存在!还有一个 .instr 文件,我认为它是实际发生的检测?

由于缺乏权限,我目前无法覆盖 C:\Windows\system32 下的 dbghelp.dll 文件。我确实尝试将位于 Microsoft Visual Studio 10.0\Common7\IDE 下的 dbghelp.dll 文件作为我的测试设置下的部署项包含在内。 dbghelp.dll(以及我也添加为部署项的 Microsoft.VisualStudio.Coverage.Symbols.dll)都存在于 Testresults out 文件夹中。但我仍然收到上述错误消息。

编辑于2012年2月17日 我在同事计算机上检查了下面提到的 dll 的版本

  • Microsoft.VisualStudio.Coverage.Symbols.dll
  • dbghelp.dll

我们在同一位置拥有完全相同的版本!将我的项目从我们的源存储库(包括测试设置)提取到他的机器上后,他能够在项目中运行测试,并随后在 VS2010 中显示代码覆盖率。那么罪魁祸首很可能不是 dll 本身,而是 Visual Studio 环境中发生的某些变化?

编辑于2012年2月17日 有人建议,此问题在我同事的计算机上运行而不是在我的计算机上运行的原因可能是由于在 GAC 中注册的 dll 版本不匹配。我尝试提取 GAC 的内容并使用 Guiffy 来获得差异,最终得到一个大约的列表。 100 个 dll 不匹配。但它们都不是版本上的,也没有与本文中提到的 dll 相关的。 我的同事还尝试安装 64 位版本的 PEX,并能够完成一次探索并随后显示测试项目的代码覆盖率。通过代码覆盖率我指的是原始VS2010功能而不是PEX中的功能来查看代码覆盖率。所以我想这种方式排除了 PEX,但仍然无法帮助我获取 VS2010 代码覆盖率结果。 :-(

编辑 2013-10-22 我刚刚分配了一台新的 Windows 8 机器,安装了 VS2010 和 R# 7.1.1000.900。我没有安装 PEX,但也遇到同样的错误。这可能与 testsettings 文件中的一些尴尬设置有关吗?我已经尝试禁用 Resharper 中的单元测试,但仍然遇到相同的错误......

I had managed to get code coverage in VS2010 Premium working with one of my solutions. Results came out and everything was fine. This was some time ago.

In the meantime I had installed PEX & Moles and experimented with using those tools a bit, i.e. completed a number of tutorials etc. Now, if I try to use the same testsettings for calculating code coverage I get the following message:

Code Coverage Analysis engine threw exception(s):
Unable to load DLL 'Microsoft.VisualStudio.Coverage.Symbols.dll'. Procedure could not be found.

(Exception from HRESULT: 0x8007007F)

(The 'procedure could not be found' is my translation of the localized text).

I've tried to include the DLL files that VS2010 is complaining about as deployment items, and I'm also able to see that they show up in the test deployment folder. However, this didn't resolve anything.

This is a consistent error no matter which project I try to calculate code coverage for. I suspect PEX/Moles is to blame because I had it working prior to installing pex and now code coverage no longer works from within the VS2010 IDE. Of course there could be other reasons, but I haven't had that many other extensions installed. Also, the time intervals between code coverage working and not working coincides more or less with me installing PEX.

Could this be related to some user setting stored somewhere? I noticed upon reinstalling the IDE that all my old settings where magically in place. Could it be that I need to delete something somewhere?

Perhaps I should also state that I instrument my assemblies locally. There's no team site or TFS server involved.

Searching for a solution I found the following links, however none of them seemed directly related to my issue:

The last link above states that one should keep the Microsoft.VisualStudio.Coverage.Symbols.dll and the Microsoft.VisualStudio.Coverage.Analysis.dll files in the same location. Both are located at the following location on my machine:

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies

My machine is actually a 64-bit machine, however, the above files are located in a 32-bit location. Could this be the cause?

Thank you for any help in resolving this issue (which might not be related to PEX at all!)

Edit 2012-02-16: I'm able to run my tests and I do also get a data.coverage file generated at the relevant location. However, upon double-clicking the data.coverage file in Explorer and trying to expand it in VS2010 (code coverage results window) I get the following error message:

Code Coverage Analysis engine threw exception(s):

Image file "name of dll file that I want to instrument" could not be found?

If I look in the out folder of my test results I can see that the DLL mentioned in the above error message is actually present! There's also a .instr file, which I take is the actual instrumentation that took place?

I'm not at present able to overwrite the dbghelp.dll file under C:\Windows\system32 due to lack of rights. I did try though to also include the dbghelp.dll file located under Microsoft Visual Studio 10.0\Common7\IDE as a deployment item under my testsettings. The dbghelp.dll (as well as Microsoft.VisualStudio.Coverage.Symbols.dll which I also added as deployment item) are both present in the Testresults out folder. But I still get the above mentioned error messages.

Edit 2012-02-17
I checked the version of the dll's mentioned below on a colleague computer

  • Microsoft.VisualStudio.Coverage.Symbols.dll
  • dbghelp.dll

We have the exact same versions located in the same place! Upon extracting my project from our source repository (incl. test settings) onto his machine he was able to run the tests in the project AND subsequently have code coverage displayed in VS2010. So the culprit is most likely not the dll's themselves, but rather something changed within the Visual Studio environment?

Edit 2012-02-17
It was suggested that the reason for this working on my collegues machine and not on mine could be due to a mismatch in the dll versions registered in the GAC. I tried extracting the content of the GAC and using Guiffy to get the difference end up with a list of approx. 100 dll mismatch. None of them on versions though and none related to the dll's mentioned in this post.
My colleague also tried installing the 64-bit version of PEX and has been able to complete a single exploration and subsequently display code coverage for a test projekt. By code coverage I refer to the original VS2010 feature and not the feature in PEX to view code coverage. So I guess this sort of rules out PEX but still doesn't help me in getting VS2010 code coverage results back. :-(

Edit 2013-10-22
I've just been assigned a new Windows 8 machine with VS2010 installed and R# 7.1.1000.900. I've not installed PEX and I get the same error. Could this be related to some awkward setting in the testsettings file? I've tried diabling the unit test in Resharper but still getting the same error...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不羁少年 2025-01-12 06:36:33

不知道和pex有没有关系。尝试将 Windows\system32 目录下的 dbghelp.dll 替换为 \Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE< 下的较新版本< /代码>。

I'm not sure if it has anything to do with Pex. Try replacing dbghelp.dll under in the Windows\system32 directory with the newer version under \Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文