I am trying to get the code coverage for a Windows service written in C++ (let's call it hello.exe) with Visual Studio 2012 Premium tools. So far I have attempted to use the method outlined in the answer to this post: How to use MS code coverage tool in command line?
For your convenience, the steps given were to run:
Answering my own question here, after a lot of trying and pouring through documents I found this:
Basically, a windows Service is different from a process so we have to enable the cross session flag and specify the user when monitoring.
start vsperfmon /coverage /output:mytestrun.coverage /cs /user:”Everyone”
So just instrument the exe as usual, start monitoring with above command, start the service, do testing, stop the service, and shutdown the monitoring.
Hope it helps someone in the future.