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
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...
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
.
User contributions licensed under CC BY-SA 3.0