<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Peter Huene's Blog</title><subtitle type="html">Got Code Coverage?</subtitle><id>http://blogs.msdn.com/phuene/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/phuene/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/phuene/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2007-05-02T13:38:00Z</updated><entry><title>Code Coverage Collection</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/phuene/archive/2007/05/14/code-coverage-collection.aspx" /><id>http://blogs.msdn.com/phuene/archive/2007/05/14/code-coverage-collection.aspx</id><published>2007-05-14T23:52:37Z</published><updated>2007-05-14T23:52:37Z</updated><content type="html">&lt;p&gt;By&amp;nbsp;the end of my last post about &lt;a href="http://blogs.msdn.com/phuene/archive/2007/05/03/code-coverage-instrumentation.aspx"&gt;code coverage instrumentation&lt;/a&gt;, we have instrumented our executable image and it's now ready for code coverage collection.&amp;nbsp; Code coverage&amp;nbsp;collection is the process of collecting the runtime data of what functions were covered during test execution.&amp;nbsp;&amp;nbsp; The end result of coverage collection will be a coverage data file which can be analyzed to show the coverage results to us in a meaningful way.&lt;/p&gt; &lt;p&gt;Visual Studio uses a&amp;nbsp;separate tool to monitor, coordinate, and flush the coverage data to the coverage file.&amp;nbsp; This tool is VSPerfMon.exe - called the "Visual Studio Performance Monitor" (named so because it was first used by the profiler).&amp;nbsp; When the monitor is started, it listens for incoming connections from executables that have been instrumented for coverage.&amp;nbsp; One of the details I didn't mention about instrumentation is that when an executable image is instrumented, the instrumentation process creates a dependency on VSCover90.dll&amp;nbsp;(9.0 for Orcas, 8.0 for 2005)&amp;nbsp;for the image being instrumented.&amp;nbsp; This is accomplished either though the PE import table for native images or through an injected P/Invoke&amp;nbsp;for managed images.&amp;nbsp; VSCover90.dll is essentially the code coverage runtime and it contains the logic for communicating with the monitor.&amp;nbsp; When VSCover90.dll is loaded and initialized, it will attempt a connection to the monitor.&amp;nbsp; If the monitor is not running, the connection will&amp;nbsp;silently fail and coverage collection will be disabled for the lifetime of the process.&amp;nbsp; An instrumented image will execute normally without the monitor running.&amp;nbsp; If, however, the monitor is running and the connection attempt succeeds, VSCover90.dll will register the hosting process and will begin coverage collection.&lt;/p&gt; &lt;p&gt;VSPerfMon.exe can be found with the other profiler and code coverage tools in "%ProgramFiles%\Microsoft Visual Studio 9.0\Team Tools\Performance Tools".&amp;nbsp; To run the monitor as a foreground process, execute the following command from a command prompt:&lt;/p&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;vsperfmon /coverage /output:&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;path_to_coverage_file&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;This will run the monitor in "stand-alone mode".&amp;nbsp; In this mode you can see the processes that have connected to and disconnected from the monitor.&amp;nbsp; The monitor traps Control-C, so to shutdown the monitor you will need to use another tool called VSPerfCmd ("Visual Studio Performance Command").&amp;nbsp; This tool communicates with the running monitor process to perform a variety of tasks.&amp;nbsp; You would execute the following command line to shutdown the monitor:&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;vsperfcmd /shutdown&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;The command tool can also be used to start the monitor in the background.&amp;nbsp; To do so, execute the following command line:&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;vsperfcmd /start:coverage /output:&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;path_to_coverage_file&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;This command will cause the monitor to be spawned as a background process.&amp;nbsp; You will use the same command as the one given above to shutdown the monitor.&lt;/p&gt;
&lt;p&gt;There are a few important things to note about the monitor that can prevent successful coverage collection:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;By default, the monitor only accepts connections from processes running under an identity that is a local administrator.&amp;nbsp; The most common problem experienced with this is that no data is collected for ASP.NET web sites.&amp;nbsp; This is due to ASP.NET web sites running under the Network Service identity by default, which is a restrictive identity meant for services that accept network connections.&amp;nbsp; To solve this, there is a /USER switch on VSPerfMon/VSPerfCmd to allow the specified user access to the monitor.&amp;nbsp; When you perform code coverage on a web site inside Visual Studio, a request is made by Visual Studio to discover what the identity of the worker process is.&amp;nbsp; This identity is then passed to the monitor to allow the connection.&amp;nbsp; This happens automatically before test execution when there is a web site checked in the code coverage section of the test run configuration. 
&lt;li&gt;By default, the monitor creates the objects and communication channels needed by the coverage runtime in a local session scope.&amp;nbsp; Therefore, if you are running the monitor in a different session from the process that will connect to the monitor (e.g. if you are not logged on from the console session and you want a service to connect to the monitor), then you need to specify the /CrossSession switch to VsPerfMon/VsPerfCmd.&amp;nbsp; This will instruct the monitor to create those objects in a global scope so that they are accessible from other sessions.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Let's recap what we have so far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Instrumentation is performed using vsinstr.exe for native, mixed mode, and managed images.&amp;nbsp; To instrument an image, execute the following: "vsinstr.exe /coverage &amp;lt;path_to_image&amp;gt;".&lt;/li&gt;
&lt;li&gt;To start the monitor process that will collect the coverage data, execute the following: "vsperfcmd /start:coverage &amp;lt;path_to_coverage_file&amp;gt;".&lt;/li&gt;
&lt;li&gt;Run the test(s) you want to collect coverage data for using the instrumented images.&lt;/li&gt;
&lt;li&gt;To stop collection, execute the following: "vsperfcmd /shutdown".&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;We now have a coverage file which we can use to view coverage results.&amp;nbsp; The coverage file can be&amp;nbsp;imported into the "Code Coverage Results" tool window inside of Visual Studio.&amp;nbsp; This will show you per-method statistics and double clicking on a method will result in opening the source file in the editor with coverage coloring turned on.&amp;nbsp; I will present a walk-through of how to accomplish everything I've been talking about so far inside of Visual Studio in a future blog entry.&lt;/p&gt;
&lt;p&gt;I will discuss how to use the coverage analysis API to read the coverage file programmatically in&amp;nbsp;my next blog entry.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2632923" width="1" height="1"&gt;</content><author><name>phuene</name><uri>http://blogs.msdn.com/members/phuene.aspx</uri></author><category term="code coverage" scheme="http://blogs.msdn.com/phuene/archive/tags/code+coverage/default.aspx" /><category term="collection" scheme="http://blogs.msdn.com/phuene/archive/tags/collection/default.aspx" /></entry><entry><title>Code Coverage Instrumentation</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/phuene/archive/2007/05/03/code-coverage-instrumentation.aspx" /><id>http://blogs.msdn.com/phuene/archive/2007/05/03/code-coverage-instrumentation.aspx</id><published>2007-05-04T06:02:00Z</published><updated>2007-05-04T06:02:00Z</updated><content type="html">&lt;p&gt;For my first on-topic blog post, I would like to give an overview of how code coverage instrumentation works in Visual Studio (it seems like a good a place to start as any).&amp;nbsp; For&amp;nbsp;basic information about what code coverage is, check out wikipedia's &lt;a href="http://en.wikipedia.org/wiki/Code_coverage" mce_href="http://en.wikipedia.org/wiki/Code_coverage"&gt;Code Coverage&lt;/a&gt; topic.&amp;nbsp; Code coverage is a feature available in Visual Studio Team Edition for Developers, Visual Studio Team Edition for Testers, and Visual Studio Team Suite.  &lt;/p&gt;&lt;p&gt;One of the most common questions I get by people that know about code coverage is what kind of code coverage does Visual Studio support.&amp;nbsp; Visual Studio uses a block-based statement (also known as C1 coverage) and condition coverage methodology.&amp;nbsp; A block is commonly defined as a sequence of instructions (in this case x86 or CIL instructions) that have a single entry point and a single exit point.&amp;nbsp; We consider an exit point to be a branch instruction, a function call, a return instruction, or, in the case of managed code, a throw instruction.  &lt;/p&gt;&lt;p&gt;I think it'll be useful to to relate this to source code, so take this (rather silly) example in C++:  &lt;/p&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;int&lt;/span&gt; foo(&lt;span class="kwrd"&gt;bool&lt;/span&gt; condition)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; i = 0;         &lt;span class="rem"&gt;/* block 0 */&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (condition)     &lt;span class="rem"&gt;/* block 0 */&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        i = 5;         &lt;span class="rem"&gt;/* block 1 */&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        i = bar();     &lt;span class="rem"&gt;/* block 2 and 3 */&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; i;          &lt;span class="rem"&gt;/* block 4 */&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;Here is the generated debug x86 of the code above (I've replaced the real addresses with easier to read "pseudo-addresses" that erroneously assumes x86 is a one byte fixed-length instruction set):&lt;/p&gt;
&lt;table unselectable="on" border="0" cellpadding="0" cellspacing="0" width="445"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;Address:&lt;/td&gt;
&lt;td valign="top" width="86"&gt;Instruction:&lt;/td&gt;
&lt;td valign="top" width="147"&gt;Arguments:&lt;/td&gt;
&lt;td valign="top" width="148"&gt;Block:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="61"&gt;0000&lt;/td&gt;
&lt;td valign="top" width="87"&gt;push&lt;/td&gt;
&lt;td valign="top" width="147"&gt;ebp&lt;/td&gt;
&lt;td valign="top" width="148"&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;0001&lt;/td&gt;
&lt;td valign="top" width="87"&gt;mov&lt;/td&gt;
&lt;td valign="top" width="147"&gt;ebp,esp&lt;/td&gt;
&lt;td valign="top" width="148"&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;0002&lt;/td&gt;
&lt;td valign="top" width="87"&gt;push&lt;/td&gt;
&lt;td valign="top" width="147"&gt;ecx&lt;/td&gt;
&lt;td valign="top" width="148"&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;0003&lt;/td&gt;
&lt;td valign="top" width="87"&gt;mov&lt;/td&gt;
&lt;td valign="top" width="147"&gt;dword ptr [i],0&lt;/td&gt;
&lt;td valign="top" width="148"&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;0004&lt;/td&gt;
&lt;td valign="top" width="87"&gt;movzx&lt;/td&gt;
&lt;td valign="top" width="147"&gt;eax,byte ptr [condition]&lt;/td&gt;
&lt;td valign="top" width="148"&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;0005&lt;/td&gt;
&lt;td valign="top" width="87"&gt;test&lt;/td&gt;
&lt;td valign="top" width="147"&gt;eax,eax&lt;/td&gt;
&lt;td valign="top" width="148"&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;0006&lt;/td&gt;
&lt;td valign="top" width="87"&gt;je&lt;/td&gt;
&lt;td valign="top" width="147"&gt;0009h&lt;/td&gt;
&lt;td valign="top" width="148"&gt;0&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;0007&lt;/td&gt;
&lt;td valign="top" width="87"&gt;mov&lt;/td&gt;
&lt;td valign="top" width="147"&gt;dword ptr [i],5&lt;/td&gt;
&lt;td valign="top" width="148"&gt;1 (due to branch)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;0008&lt;/td&gt;
&lt;td valign="top" width="87"&gt;jmp&lt;/td&gt;
&lt;td valign="top" width="147"&gt;000Bh&lt;/td&gt;
&lt;td valign="top" width="148"&gt;1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;0009&lt;/td&gt;
&lt;td valign="top" width="87"&gt;call&lt;/td&gt;
&lt;td valign="top" width="147"&gt;bar&lt;/td&gt;
&lt;td valign="top" width="148"&gt;2 (due to branch)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;000A&lt;/td&gt;
&lt;td valign="top" width="87"&gt;mov&lt;/td&gt;
&lt;td valign="top" width="147"&gt;dword ptr [i],eax&lt;/td&gt;
&lt;td valign="top" width="148"&gt;3 (due to call)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;000B&lt;/td&gt;
&lt;td valign="top" width="87"&gt;mov&lt;/td&gt;
&lt;td valign="top" width="147"&gt;eax,dword ptr[i]&lt;/td&gt;
&lt;td valign="top" width="148"&gt;4 (multiple entry points)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;000C&lt;/td&gt;
&lt;td valign="top" width="87"&gt;mov&lt;/td&gt;
&lt;td valign="top" width="147"&gt;esp,ebp&lt;/td&gt;
&lt;td valign="top" width="148"&gt;4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;000D&lt;/td&gt;
&lt;td valign="top" width="87"&gt;pop&lt;/td&gt;
&lt;td valign="top" width="147"&gt;ebp&lt;/td&gt;
&lt;td valign="top" width="148"&gt;4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="62"&gt;000E&lt;/td&gt;
&lt;td valign="top" width="87"&gt;ret&lt;/td&gt;
&lt;td valign="top" width="147"&gt;&amp;nbsp;&lt;/td&gt;
&lt;td valign="top" width="148"&gt;4&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Notice that everything up to and including the first branch instruction (je) is considered to be part of the first block.&amp;nbsp; Everything up to and including the next branch instruction (jmp) is part of the second block.&amp;nbsp; The third block is comprised of only the call instruction for the bar function.&amp;nbsp; The fourth block is comprised of storing the return value from the call to bar in the variable i.&amp;nbsp; You'll notice that per the definition of a block as a single entry and single exit sequence of instructions, the instruction at 0x000B has two entry points: as the next instruction from 0x000A and also from the unconditional jump at 0x0008.&amp;nbsp; Therefore, it is also considered the start of a new block and everything up to the final ret instruction is the fifth block.&amp;nbsp; So as you can see, a single line of source code can actually be more than one block.&lt;/p&gt;
&lt;p&gt;The job of instrumentation is to modify the original executable image so that we can detect when blocks are "hit" during execution.&amp;nbsp; To accomplish this, a few instructions (in the case of x86: a push, two movs, and a pop) are inserted before every block to toggle a byte in a buffer&amp;nbsp;that says that the block was executed.&amp;nbsp; You can easily see these instructions by disassembling an instrumented image.&amp;nbsp; Additional information that is required to map a block back to the original source code is also stored in the instrumented image in the form of PE sections.&amp;nbsp; The instrumentation tool relies on debug information to be present to perform the instrumentation.&amp;nbsp; Because the instrumentation process modifies the image, a new debug information database will be written out and referenced from the instrumented executable.&amp;nbsp; By default, the instrumentation tool does an "in-place" instrumentation and overwrites the image being instrumented.&amp;nbsp; The original image is backed up just in case something goes wrong.&amp;nbsp; The instrumented debug information database is actually written out as a different file, so the original debug information database does not need to be backed up.&lt;/p&gt;
&lt;p&gt;The instrumentation tool used by Visual Studio is called vsinstr.exe.&amp;nbsp; This is also the same instrumentation tool used by the profiler to perform trace profiling, however the instrumentation process is quite different than the one used&amp;nbsp;for code&amp;nbsp;coverage.&amp;nbsp; You can find this tool (assuming you're using&amp;nbsp;Orcas) in "%Program Files%\Microsoft Visual Studio 9.0\Team Tools\Performance Tools", which is not actually on the default path for a Visual Studio command prompt.&amp;nbsp; In Orcas, vsinstr.exe supports the instrumentation of native x86, mixed mode x86, and managed images.&amp;nbsp; Unfortunately, 64-bit support did not make it into Orcas, but it is something we would like to get in for a future release.&amp;nbsp; To use vsinstr.exe, simply give it the /coverage switch and the path to the image to instrument:&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;vsinstr.exe /coverage foo.dll&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;This will generate foo.dll (instrumented), foo.instr.pdb (the instrumented pdb referenced by the instrumented foo.dll), and foo.dll.orig (the backed-up original foo.dll).&amp;nbsp; I will cover exactly how to automatically accomplish the same thing&amp;nbsp;inside of Visual Studio using a screenshot walkthrough in an upcoming blog entry.&lt;/p&gt;
&lt;p&gt;Once an image is instrumented, it is ready for coverage collection, which will be the focus of my next post.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2404081" width="1" height="1"&gt;</content><author><name>phuene</name><uri>http://blogs.msdn.com/members/phuene.aspx</uri></author><category term="code coverage" scheme="http://blogs.msdn.com/phuene/archive/tags/code+coverage/default.aspx" /><category term="instrumentation" scheme="http://blogs.msdn.com/phuene/archive/tags/instrumentation/default.aspx" /></entry><entry><title>Welcome to my blog!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/phuene/archive/2007/05/02/welcome-to-my-blog.aspx" /><id>http://blogs.msdn.com/phuene/archive/2007/05/02/welcome-to-my-blog.aspx</id><published>2007-05-02T23:38:00Z</published><updated>2007-05-02T23:38:00Z</updated><content type="html">&lt;p&gt;Hello, my name is Peter and I'm a recovering ex-softie.&amp;nbsp; I returned a few months ago to Microsoft after a little more than two years away from the company.&amp;nbsp; I graduated with a BS in Computer Science from Virginia Tech (I'm also a diehard hokie fan) in 2002.&amp;nbsp; I was a three-time intern before joining Microsoft in as a developer on the Visual C++ project system team.&amp;nbsp; During that time I contributed to Visual&amp;nbsp;C++ 2002, 2003, and 2005.&lt;/p&gt;
&lt;p&gt;I return as a developer on the diagnostics team&amp;nbsp;that is part of&amp;nbsp;Team Developer (Visual Studio Team Edition for Developers), or TeamDev as we like to call it.&amp;nbsp; The diagnostics team owns the debugger, profiler, and code coverage tools within Visual Studio.&amp;nbsp; I am responsible for the code coverage tools and that will be the primary focus of this blog.&amp;nbsp; I will try to also talk about the great things the rest of TeamDev is doing as there are some fantastic things&amp;nbsp;in the works for both Orcas and beyond.&lt;/p&gt;
&lt;p&gt;I am by no means a prolific blogger, but I will try to get some good content sooner than later :).&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2373728" width="1" height="1"&gt;</content><author><name>phuene</name><uri>http://blogs.msdn.com/members/phuene.aspx</uri></author></entry></feed>