1

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...

Community
  • 1
  • 1
llykke
  • 253
  • 2
  • 14
  • Have you tried copying the assembly to your output folder before running the tests. In scenarios like this where it isn't a true project reference, but one added when moles/pex reinstruments your code, I add the assembly with a build action of copy always. – Shaun Wilde Feb 14 '12 at 08:26
  • I forgot to mention that the above code coverage generation is without using PEX/Moles. I'm unable to get VS2010 to generate code coverage using the basic features in VS2010 Premium. I have configured my testsettings and I have also had code coverage generated correctly prior to installing PEX/Moles. So I'm not using PEX/Moles for instrumentation of my code. However, I suspect that the installation of PEX has somehow changed the normal VS2010 behavior and thus caused the above mentioned error message. – llykke Feb 14 '12 at 11:30
  • @Shaun Wilde: I tried your suggestion but I still get the same error as mentioned in the post. – llykke Feb 14 '12 at 12:43
  • I'm experiencing the same issue. – jayint32 Mar 27 '12 at 20:34
  • Huh. I went into test settings and de-selected Test Impact, leaving only coverage, restarted Visual Studio and tried again. Then it worked perfectly. I have Resharper and CodeRush both installed and have been using Resharper's test runner earlier today. Maybe there is a conflict? – jayint32 Mar 27 '12 at 20:51
  • This didn't work out for me. Tried setting/unsetting Test Impact => no change. Tried uninstalling R# and reinstalling VS2010 => No change. I'm using v. 6.1 of R# – llykke Mar 29 '12 at 06:47

1 Answers1

0

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.

shamp00
  • 11,106
  • 4
  • 38
  • 81
  • The file version under VS2010\Common7\IDE is 6.12.2.633 (03-03-2012). The version under Windows\System32 is 6.1.7601.17514 (20-11-2010). I'll try your suggestion – llykke Feb 16 '12 at 11:44
  • As I've mentioned in the edited post a collegue of mine was able to get code coverage and have it displayed with the exact same version of DLL's as my own. So it shouldn't be necessary to copy any files anywhere. In any case, only the user TrustedInstaller is able to place overwrite the dbghelp.dll file in C:\Windows\System32. And that isn't me :-( – llykke Feb 17 '12 at 07:42
  • The error message definitely points to an assembly version mismatch. I would compare the GAC on you and your colleague's machines. You can use a [tool](http://gaccompare.codeplex.com/) or just use gacutil as described [here](http://stackoverflow.com/questions/6598979/compare-gacs-from-two-servers). (I think you might need administrative rights though...) – shamp00 Feb 17 '12 at 08:48
  • I tried your suggestion and posted the results in an edit comment to the original question. Unfortunately, I was unable to determine any assembly version mismatch performing a GAC list comparison nor was I able to see any of the DLL's mentioned in this post in the extraction performed using gacutil on either machines. – llykke Feb 17 '12 at 12:21
  • Hmm... what a hassle. Did you check the registration of *MSDia100.dll*? (`regsvr32 "%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\msdia100.dll"`). Otherwise reinstalling Visual Studio is all I can think of. – shamp00 Feb 17 '12 at 14:38
  • I executed the command which you've stated and succesfully registered msdia100.dll (Why that file?). This didn't resolve the issue of not displaying results from code coverage. I still get the error message stated at the top of the post (reg. Microsoft.VisualStudio.Coverage.Symbols.dll). I have already tried both a repair and a reinstall of VS2010 prior to actually posting this question. This didn't help either. So maybe it's because of some user setting that's been set? Anyway, thanks for trying :-) – llykke Feb 20 '12 at 07:20