I am following article for code coverage in VS 2013 http://msdn.microsoft.com/en-us/library/dd537628.aspx. It shows coverage of Test and not actual code.
I have selected unit test from Test explorer and click on Analyze Code Coverage -> Selected Test
. Code coverage window is opened up at the bottom and It shows dll of unit test and its coverage and actual dll with code coverage is not shown.
Also, I looked into article http://msdn.microsoft.com/library/jj159523.aspx. Copied pdbs and dll into same location. In the code coverage window message was
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"
Any idea about this?
I have tried steps given in the link.
http://blogs.msdn.com/b/allendm/archive/2012/09/08/empty-coverage-file-with-profiler-related-errors-in-the-event-logs.aspx
Slight change if you are using VS 2013.
a) Environment variable VS120COMNTOOLS is set to \common7\tools
b) Regkey HKLM\SOFTWARE\Microsoft\VisualStudio\12.0\InstallDir is set to your \Common7\IDE\
c) covrun32.dll and covrun64.dll exist in "\Team Tools\Dynamic Code Coverage"
Removed VS110COMNTOOLS environment variable. These changes worked for me.
I was able to resolve my issue. The reason why code coverage was not happening on my production DLL was: reason = "has_fixed_base". Once I changed this setting to: Yes (
/DYNAMICBASE
), the coverage started working.It would help to check these steps:
Linker->Advanced
pageRandomized Base Address
/DYNAMICBASE
)This should start code coverage.