Visual C++ Code Coverage Works with Unmanaged Code

This makes me happy:  The code coverage support in Visual Studio Team Developer works with unmanaged code. 

Many cool toys in VSTD only work with managed code (which is understandable), but I still spend most of my days in an unmanaged world. 

The process in this article walks you through instrumenting and running an unmanaged binary from the command line, but here are a couple of hints:

  • It’s “vsinstr” not “vsintr” (the original article has a typo)
  • You need to link with /profile to use the coverage tool.  I tried using “Instrument” on the “Profile Guided Optimization” menu, and got a VSP2005 Internal Instrumentation Error, that my file “must be rebuilt with approved tools”.
  • To view the .coverage file, just open it in Visual Studio.