<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Habib Heydarian's Blog @ Microsoft : VSTS Developing</title><link>http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx</link><description>Tags: VSTS Developing</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Debugging a COM object (Runtime Callable Wrapper) with Visual Studio 2010</title><link>http://blogs.msdn.com/habibh/archive/2009/09/22/debugging-a-com-object-runtime-callable-wrapper-with-visual-studio-2010.aspx</link><pubDate>Tue, 22 Sep 2009 10:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9897824</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9897824.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9897824</wfw:commentRss><description>&lt;p&gt;If you have written managed code that uses a COM object, then you are probably familiar with &lt;strong&gt;System.__ComObject&lt;/strong&gt;. When a COM object lacks a Runtime Callable Wrapper (RCW), the CLR provides a generic RCW which is an instance of the type &amp;quot;System.__ComObject&amp;quot;. Unfortunately, one of the downsides to System.__ComObject is that the Visual Studio 2008 debugger cannot display its members.&lt;/p&gt;  &lt;p&gt;Let's look at an example. When I was writing this blog post, I wrote a tiny console application that would speak the word &amp;quot;Hello&amp;quot; using the Microsoft Speech Object Library (SpeechLib) which is a COM API.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; SpeechLib;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Sample&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;         SpVoice spVoice = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SpVoice();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;         spVoice.Speak(&lt;span style="color: #006080"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;, SpeechVoiceSpeakFlags.SVSFDefault);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Unfortunately, as soon as I ran the application, the application threw a COMException with the HRESULT 0x8004503A, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Application exception" border="0" alt="Application exception" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/DebuggingCOMobjectsjustgotawholeloteasie_13770/image_5.png" width="798" height="529" /&gt; &lt;/p&gt;

&lt;p&gt;Since I didn't know what the problem was, I added the variable &amp;quot;spVoice&amp;quot; to the Watch window to have a closer look. However, the debugger couldn't show me anything since I didn't have a RCW for SpeechLib and hence the CLR had generated a generic one at runtime. So, I'm somewhat stuck at this point.&lt;/p&gt;

&lt;p&gt;Luckily, in Visual Studio 2010, there is now a &amp;quot;Dynamic View&amp;quot; that displays all the members of a COM object of type System.__ComObject, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/DebuggingCOMobjectsjustgotawholeloteasie_13770/image_9.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/DebuggingCOMobjectsjustgotawholeloteasie_13770/image_thumb_3.png" width="835" height="196" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Expanding the &amp;quot;Dynamic View&amp;quot; node displays the members of spVoice. As can be seen from the screenshot below, the reason for the exception was because the audio service on my computer wasn't running. This makes sense since I was running this demo on the Hyper-V virtual machine.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/DebuggingCOMobjectsjustgotawholeloteasie_13770/image_6.png" width="809" height="315" /&gt; &lt;/p&gt;

&lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9897824" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category></item><item><title>Coverage of the Visual Studio 2010 Historical Debugger</title><link>http://blogs.msdn.com/habibh/archive/2009/09/21/coverage-of-the-visual-studio-2010-historical-debugger.aspx</link><pubDate>Mon, 21 Sep 2009 10:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9897051</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9897051.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9897051</wfw:commentRss><description>&lt;p&gt;During the last couple of months, I've covered the Historical Debugger extensively. If you are interested in learning more about this new feature in Visual Studio 2010, the following blog entries should help you get started.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/habibh/archive/2009/06/18/an-in-depth-look-at-the-historical-debugger-in-visual-studio-2010-part-i.aspx"&gt;An in depth look at the Historical Debugger in Visual Studio 2010 (Part I)&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/habibh/archive/2009/06/18/an-in-depth-look-at-the-historical-debugger-in-visual-studio-2010-part-ii.aspx"&gt;An in depth look at the Historical Debugger in Visual Studio 2010 (Part II)&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/habibh/archive/2009/06/18/an-in-depth-look-at-the-historical-debugger-in-visual-studio-2010-part-iii.aspx"&gt;An in depth look at the Historical Debugger in Visual Studio 2010 (Part III)&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/habibh/archive/2009/06/18/an-in-depth-look-at-the-historical-debugger-in-visual-studio-2010-part-iv.aspx"&gt;An in depth look at the Historical Debugger in Visual Studio 2010 (Part IV)&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/habibh/archive/2009/06/18/an-in-depth-look-at-the-historical-debugger-in-visual-studio-2010-part-v.aspx"&gt;An in depth look at the Historical Debugger in Visual Studio 2010 (Part V)&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/habibh/archive/2009/07/14/debugging-linq-to-sql-queries-using-the-historical-debugger.aspx"&gt;Debugging LINQ to SQL queries using the Historical Debugger&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/habibh/archive/2009/07/23/the-anatomy-of-the-historical-debugger-navigation-bar-navbar.aspx"&gt;The anatomy of the Historical Debugger Navigation Bar (Navbar)&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/habibh/archive/2009/08/04/how-to-debug-an-exception-with-the-visual-studio-2010-historical-debugger.aspx"&gt;How to debug an exception with the Visual Studio 2010 Historical Debugger&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9897051" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Historical+Debugger/default.aspx">Historical Debugger</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category></item><item><title>An in depth look at the Historical Debugger in Visual Studio 2010 (Part VI)</title><link>http://blogs.msdn.com/habibh/archive/2009/09/18/an-in-depth-look-at-the-historical-debugger-in-visual-studio-2010-part-vi.aspx</link><pubDate>Sat, 19 Sep 2009 06:48:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9897049</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9897049.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9897049</wfw:commentRss><description>&lt;p&gt;In previous blogs, I have covered the Historical Debugger extensively and talked about many of the scenarios. In this post, I'll walk through another scenario where the Historical Debugger is very useful which is Load Testing. When loading testing an application, you can have the Historical Debugger collect information during the run and if one or more of the tests fail, you can use the Historical Debugger log file to debug the test failure(s).&lt;/p&gt;  &lt;p&gt;Let's walk through an example. For this walkthrough, I have a Load Test which contains a single Web Test. The application under test is the&amp;#160; BeerHouse sample application.&lt;/p&gt;  &lt;p&gt;The first step in setting up the Historical Debugger for collecting data during load testing is to enable the &amp;quot;Diagnostic Tracing&amp;quot; option in the Test Settings, as shown below.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Test Settings" border="0" alt="Test Settings" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/AnindepthlookattheHistoricalDebuggerinVi_96C6/image_3.png" width="766" height="567" /&gt;&lt;/p&gt;  &lt;p&gt;Once you've enabled the Historical Debugger, the next step is to run the Load Test. After the Load Test is complete, you should see the test result details which also includes the number of errors, shown below.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/AnindepthlookattheHistoricalDebuggerinVi_96C6/image_5.png" width="862" height="656" /&gt; &lt;/p&gt;  &lt;p&gt;While the Load Test was executing, the Historical Debugger was recording the execution history. The following screenshot shows the Historical Debugger log file (QTAgent32_000013d0_090918_204309.tdlog).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/AnindepthlookattheHistoricalDebuggerinVi_96C6/image_6.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Historical Debugger Log file" border="0" alt="Historical Debugger Log file" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/AnindepthlookattheHistoricalDebuggerinVi_96C6/image_thumb.png" width="813" height="424" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Double-clicking the log file opens the Historical Debugger Summary page, shown below. Using the summary page, you can investigate the root cause of the test failure.&lt;/p&gt;  &lt;p&gt;&lt;img title="Historical Debugger Summary page" border="0" alt="Historical Debugger Summary page" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/AnindepthlookattheHistoricalDebuggerinVi_DCB2/image_21.png" width="880" height="811" /&gt;&lt;/p&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9897049" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Historical+Debugger/default.aspx">Historical Debugger</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category></item><item><title>Troubleshooting common breakpoint problems in the Visual Studio debugger (Part I)</title><link>http://blogs.msdn.com/habibh/archive/2009/09/01/troubleshooting-common-breakpoint-problems-in-the-visual-studio-debugger-part-i.aspx</link><pubDate>Wed, 02 Sep 2009 03:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9898241</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9898241.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9898241</wfw:commentRss><description>&lt;p&gt;On the Visual Studio debugger team, one of the areas where we regularly receive feedback is when breakpoints don't work. Furthermore, some of the error messages that the debugger displays when a breakpoint fails are generic so it might be hard to diagnose why a breakpoint doesn't work correctly (we're working to improve these error messages). In this blog post and subsequent posts, I'm going to cover the most common reasons why breakpoints don't work in the Visual Studio debugger and provide potential workarounds.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;When trying to set a breakpoint in a C# or VB method, you see the following error message:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;The common language runtime was unable to set the breakpoint.&lt;/em&gt;&lt;/p&gt;  &lt;h3&gt;Description&lt;/h3&gt;  &lt;p&gt;This error occurs because the application that you are debugging is optimized and the method where you are trying to set the breakpoint has been optimized away and hence, doesn't exist in the running application. This typically happens if your project configuration is set to &lt;strong&gt;Release&lt;/strong&gt; mode which enables the compiler setting to optimize code, as shown below. One way to fix this problem is to set the project configuration to &lt;strong&gt;Debug &lt;/strong&gt;which disables optimizations.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Project Properties" border="0" alt="Project Properties" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/Troubleshootingcommonbreakpointproblemsi_F784/image_3.png" width="805" height="350" /&gt;&lt;/p&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9898241" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category></item><item><title>How to debug a 64-bit dump using the Visual Studio debugger</title><link>http://blogs.msdn.com/habibh/archive/2009/08/31/how-to-debug-a-64-bit-dump-using-the-visual-studio-debugger.aspx</link><pubDate>Tue, 01 Sep 2009 04:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9897837</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9897837.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9897837</wfw:commentRss><description>&lt;p&gt;One of the questions that comes up about debugging dump files is how to debug a dump file that was created from a 64-bit process. The reason why this question comes up is because Visual Studio itself is a 32-bit application and therefore, cannot debug a 64-bit dump file (or process). As a result, the first time that a developer tries to debug a 64-bit dump file, he (or she) typically runs across the following error message:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;The 32-bit version of Visual Studio cannot debug 64-bit processes or 64-bit dumps. Please remote debug with the 64-bit version of Visual Studio Remote Debugging Monitor (MSVSMON.exe) instead.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;To fix this problem, before you start debugging the dump file, run the 64-bit version of msvsmon.exe from &lt;em&gt;%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x64&lt;/em&gt;. However, even after doing so, you might see the following error message:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;The version of this file is not compatible with the version of Windows you're running. Check you computer's system information to see whether you need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Unfortunately, this error is rather confusing and doesn't tell you anything about the root cause. The problem here is that you are running a 32-bit operating system and therefore, cannot run a 64-bit process. Hence, you need a 64-bit operating system to run the 64-bit version of msvsmon.exe.&lt;/p&gt;  &lt;p&gt;To summarize, in order to debug a 64-bit dump in the Visual Studio debugger, the following conditions need to be met:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;You need a 64-bit version of Windows&lt;/li&gt;    &lt;li&gt;You need to run the 64-bit version of msvsmon.exe first&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9897837" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category></item><item><title>Create your own Code Analysis rule set using Visual Studio Team System 2010</title><link>http://blogs.msdn.com/habibh/archive/2009/08/12/create-your-own-code-analysis-rule-set-using-visual-studio-team-system-2010.aspx</link><pubDate>Wed, 12 Aug 2009 10:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9865693</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9865693.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9865693</wfw:commentRss><description>&lt;p&gt;In a previous &lt;a href="http://blogs.msdn.com/habibh/archive/2009/07/31/discover-dead-code-in-your-application-using-code-analysis.aspx"&gt;post&lt;/a&gt;, I explained how to use Code Analysis in Visual Studio 2010 to detect dead code. In that post, I described the following five Code Analysis rules in detail and how these &lt;em&gt;set of rules&lt;/em&gt; form the basis for detecting dead code:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Private methods that are not called from any other code (CA1811) &lt;/li&gt;    &lt;li&gt;Unused local variables (CA1804) &lt;/li&gt;    &lt;li&gt;Unused private fields (CA1823) &lt;/li&gt;    &lt;li&gt;Unused parameters (CA1801) &lt;/li&gt;    &lt;li&gt;Internal classes that are not instantiated from any other code (CA1812) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;To take this one step further, it would make sense to be able to treat this set of rules as one entity so I can manage all the rules for dead code detection as a single entity. In Visual Studio 2010, we have introduced the notion of a &lt;em&gt;&lt;strong&gt;rule set&lt;/strong&gt;&lt;/em&gt; that allows you to do exactly that.&lt;/p&gt;  &lt;h2&gt;What is a &amp;quot;rule set&amp;quot;?&lt;/h2&gt;  &lt;p&gt;Think of a rule set as a container or collection of rules. A rule set allows you to bundle one or more Code Analysis rules into an arbitrary category for easier management of those rules. For example, in Team System 2010, we are providing a number of rule sets out of the box:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Microsoft Security Rules &lt;/li&gt;    &lt;li&gt;Microsoft Basic Correctness Rules &lt;/li&gt;    &lt;li&gt;Microsoft Globalization Rules &lt;/li&gt;    &lt;li&gt;etc. &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;How to create a rule set&lt;/h2&gt;  &lt;p&gt;For our walkthrough, we want to create a rule set called &lt;strong&gt;&lt;em&gt;Dead Code Detection Rules&lt;/em&gt;&lt;/strong&gt; that contains the five dead code detection rules mentioned above. The first step in creating a rule set is to create a new rule set file (*.ruleset). You can create a new rule set file via &lt;em&gt;File –&amp;gt; New –&amp;gt; File&lt;/em&gt;. In this example, I've given the rule set the name &lt;strong&gt;DeadCodeDetectionRules.ruleset&lt;/strong&gt;, as shown below.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="New file dialog" border="0" alt="New file dialog" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/CreateyourownCodeAnalysisrulesetusingVis_13F64/image_19.png" width="823" height="583" /&gt; &lt;/p&gt;  &lt;p&gt;After creating the rule set, set the name and description of the rule set using the Properties window, as shown in the following screen shot.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Rule set Properties window" border="0" alt="Rule set Properties window" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/CreateyourownCodeAnalysisrulesetusingVis_13F64/image_16.png" width="421" height="388" /&gt; &lt;/p&gt;  &lt;p&gt;Since the rule set doesn't contain any rules yet, the rule set editor shows none of the rules as being checked. The rule set editor (shown below) is a new window in Visual Studio Team System 2010 that allows you manage rules and rule sets.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Dead Code Rules rule set" border="0" alt="Dead Code Rules rule set" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/CreateyourownCodeAnalysisrulesetusingVis_13F64/image_5.png" width="807" height="359" /&gt; &lt;/p&gt;  &lt;p&gt;To start adding rules to the DeadCodeDetectionRules rule set, you can search for a rule using either the rule number or its name, as shown below. You can also simply expand the rule categories and select the rules that you are interested in.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/CreateyourownCodeAnalysisrulesetusingVis_13F64/image_7.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Search in Rule set editor" border="0" alt="Search in Rule set editor" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/CreateyourownCodeAnalysisrulesetusingVis_13F64/image_thumb_2.png" width="807" height="350" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;After adding all five dead code detection rules, the rule set editor should look something like this:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Rule set editor with added rules" border="0" alt="Rule set editor with added rules" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/CreateyourownCodeAnalysisrulesetusingVis_13F64/image_22.png" width="804" height="345" /&gt; &lt;/p&gt;  &lt;h2&gt;Applying a rule set to a project&lt;/h2&gt;  &lt;p&gt;Once the rule set has been created, the next step is to apply the rule set to a project. This can be done via the Project Properties window. On the Code Analysis tab, click the dropdown next to the [Open] button and select &amp;quot;Browse...&amp;quot; to browse to the location of the rule set file. After selecting the rule set, the name and description of the rule set are shown in the summary page.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Applying a rule set." border="0" alt="Applying a rule set." src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/CreateyourownCodeAnalysisrulesetusingVis_13F64/image_25.png" width="804" height="533" /&gt; &lt;/p&gt;  &lt;p&gt;So now, all the dead code detection rules are part of a single rule set which make it much easier to manage, modify and apply the rules at both the project level as well as TFS policy level.&lt;/p&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9865693" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Team+System+2010/default.aspx">Team System 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Code+Analysis/default.aspx">Code Analysis</category></item><item><title>Visualize project dependencies with the Team System 2010 Architecture Explorer</title><link>http://blogs.msdn.com/habibh/archive/2009/08/06/visualize-project-dependencies-with-the-team-system-2010-architecture-explorer.aspx</link><pubDate>Thu, 06 Aug 2009 10:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9858711</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9858711.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9858711</wfw:commentRss><description>&lt;p&gt;As early as Visual Studio 2002, Visual Studio has supported the ability to see the dependencies between projects in a solution. However, the experience is somewhat clunky in that you can only see the dependencies one project at a time.&lt;/p&gt;  &lt;p&gt;In the example below, you can see the project dependencies for the &lt;em&gt;Patient Monitoring&lt;/em&gt; project. However, as I mentioned above, the major drawback to this approach is that you can only see the dependencies one project at a time and don't get to see a &amp;quot;global view&amp;quot; of your solution. There is also another scenario that today's solution doesn't solve. The problem is that the only way to find out &lt;em&gt;why&lt;/em&gt; a dependency exists is to look at the code or use some other tool. In the screenshot below, the &lt;strong&gt;Project Dependencies&lt;/strong&gt; dialog doesn't tell you why the &lt;em&gt;Patient Monitoring&lt;/em&gt; project is dependent on the &lt;em&gt;Chart&lt;/em&gt; project.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Project dependencies" border="0" alt="Project dependencies" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/VisualizeprojectdependencieswiththeTeamS_11E50/image_16.png" width="800" height="600" /&gt; &lt;/p&gt;  &lt;p&gt;Architecture Explorer in Team System 2010 not only allows you to see the project dependencies for the entire solution but it also allows you to see the reason why each dependency exists. Each arrow in the screenshot below represents a dependency. Furthermore, the thickness of an arrow indicates the size of the dependency. Notice that there are no arrows going in or out of the ChartVisuals project. Using the Architecture Explorer, I discovered that this project is not being used anywhere!&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Architecture Explorer diagram" border="0" alt="Architecture Explorer diagram" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/VisualizeprojectdependencieswiththeTeamS_11E50/image_13.png" width="638" height="650" /&gt; &lt;/p&gt;  &lt;p&gt;To investigate a dependency further, you can expand the chevron (double arrows) on each node. This will not only display the classes within a project but it will also draw arrows from the classes that have dependencies on other projects. You can even dig one level deeper to see the &lt;em&gt;methods&lt;/em&gt; in those classes that are calling into the dependencies. This is shown via the blue arrows below.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Architecture Explorer diagram expanded" border="0" alt="Architecture Explorer diagram expanded" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/VisualizeprojectdependencieswiththeTeamS_11E50/image_19.png" width="879" height="652" /&gt; &lt;/p&gt;  &lt;p&gt;In a future blog post, I'll walk through how to use the Architecture Explorer to analyze circular references and class coupling.&lt;/p&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9858711" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Team+System+2010/default.aspx">Team System 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category></item><item><title>PDC 2009: Developing Quality Software using Visual Studio Team System 2010</title><link>http://blogs.msdn.com/habibh/archive/2009/08/05/pdc-2009-developing-quality-software-using-visual-studio-team-system-2010.aspx</link><pubDate>Wed, 05 Aug 2009 10:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9857757</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9857757.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9857757</wfw:commentRss><description>&lt;p&gt;Software quality is a subject that is near and dear to my heart. At PDC 2009 this year, there is full day workshop on how to use Visual Studio Team System 2010 to &lt;a href="http://microsoftpdc.com/Sessions/Developing-Quality-Software-using-Visual-Studio-Team-System-2010"&gt;develop high quality software&lt;/a&gt;. I'm really excited about this workshop since it covers a lot of the features that my team works on including the debugger, profiler, code analysis, Historical Debugger, code coverage, etc.&lt;/p&gt;  &lt;p&gt;By the way, if you are heading down to PDC09, feel free to drop by the Visual Studio Team System booth for a chat. Who knows, I might also be giving a talk or two on the new developer features in Team System 2010.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/PDC2009DevelopingQualitySoftwareusingVis_14AF8/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="PDC09" border="0" alt="PDC09" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/PDC2009DevelopingQualitySoftwareusingVis_14AF8/image_thumb.png" width="242" height="242" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9857757" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Team+System+2010/default.aspx">Team System 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Announcements/default.aspx">Announcements</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category></item><item><title>How to debug an exception with the Visual Studio 2010 Historical Debugger</title><link>http://blogs.msdn.com/habibh/archive/2009/08/04/how-to-debug-an-exception-with-the-visual-studio-2010-historical-debugger.aspx</link><pubDate>Wed, 05 Aug 2009 09:08:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9857747</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9857747.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9857747</wfw:commentRss><description>&lt;p&gt;In a previous &lt;a href="http://blogs.msdn.com/habibh/archive/2009/07/14/debugging-linq-to-sql-queries-using-the-historical-debugger.aspx"&gt;blog&lt;/a&gt;, I covered how to debug a LINQ to SQL query using the Historical Debugger. In this blog, I'll discuss using the Historical Debugger to debug an exception. The are a couple of reasons why the Historical Debugger is so useful when it comes to debugging exceptions:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;If your application handles the exception (catches it), you can see where it occurred &lt;/li&gt;    &lt;li&gt;You can see what happened &lt;em&gt;before&lt;/em&gt; and &lt;em&gt;after&lt;/em&gt; the exception. The ramifications of this capability are tremendous! &lt;/li&gt;    &lt;li&gt;You can double-click on an exception and go directly in your code where the exception occurred or was handled. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Let's go through an example. In the following screenshot, you can see that there are a number exceptions that were both thrown and caught. This is indicated by the &lt;strong&gt;&lt;em&gt;Exception:&lt;/em&gt;&lt;/strong&gt; prefix.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Debug History window" border="0" alt="Debug History window" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/HowtodebuganexceptionwiththeVisualStudio_1228B/image_3.png" width="513" height="538" /&gt; &lt;/p&gt;  &lt;p&gt;Double-clicking on the exception above brings up the source window and displays the method where the exception occurred.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Historical Debugger in source" border="0" alt="Historical Debugger in source" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/HowtodebuganexceptionwiththeVisualStudio_1228B/image_8.png" width="805" height="602" /&gt;&lt;/p&gt;  &lt;p&gt;Last but not least, using the Debug History window, you can filter out all other events and only display exceptions, as shown below.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Filter exceptions in Debug History window" border="0" alt="Filter exceptions in Debug History window" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/HowtodebuganexceptionwiththeVisualStudio_1228B/image_11.png" width="517" height="542" /&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9857747" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Historical+Debugger/default.aspx">Historical Debugger</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category></item><item><title>Catch string formatting bugs with Visual Studio Team System 2010</title><link>http://blogs.msdn.com/habibh/archive/2009/08/03/catch-string-formatting-bugs-with-visual-studio-team-system-2010.aspx</link><pubDate>Tue, 04 Aug 2009 03:43:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9856655</guid><dc:creator>habibh</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9856655.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9856655</wfw:commentRss><description>&lt;p&gt;Formatting strings is a very common task in .NET development. Examples include formatting dates and currencies, composing a HTML response, creating error messages, etc. One of the downsides of string formatting is that if done incorrectly, you can end up with subtle bugs that won't be detected until runtime at which point, the application usually crashes with an exception.&lt;/p&gt;  &lt;p&gt;Take the following code sample which comes from a real world application. It compiles fine and &lt;em&gt;most&lt;/em&gt; of the time, it also runs without any problems However, once in a while, there is a customer complaint that the application crashes. It turns out that the &lt;font face="Courier New"&gt;if&lt;/font&gt; part of the code is rarely executed and because it isn't a common scenario, it wasn't tested.&lt;/p&gt;  &lt;p&gt;So, what is the problem? If you look closely at line 6 below where the string &lt;font face="Courier New"&gt;body&lt;/font&gt; is formatted, the second format item which is supposed to be the user's name is missing. As I mentioned above, there is no compiler warning or error to tell the developer about this problem. It's usually found during testing or worse case, in production.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; btnSubmit_Click(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (isEditingPost)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; body = txtBody.Value;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;         body += &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #006080"&gt;&amp;quot;&amp;lt;p&amp;gt;-- {0}: post edited by {1}.&amp;lt;/p&amp;gt;&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;            DateTime.Now.ToString());&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// edit an existing post&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;         Post.UpdatePost(postID, txtTitle.Text, body);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;         panInput.Visible = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;         panFeedback.Visible = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// Rest of code not shown&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;In Team System 2010, we have added a new rule to Code Analysis that detects this exact problem. When I run Code Analysis over the code above, it clearly warns me that I'm missing a format item:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;warning: CA2241 : Microsoft.Usage : Method 'AddEditPost.btnSubmit_Click(object, EventArgs)' calls 'string.Format(string, object)' and does not provide an argument for format item &amp;quot;{1}&amp;quot;. The provided format string is: '&amp;quot;&amp;lt;p&amp;gt;-- {0}: post edited by {1}.&amp;lt;/p&amp;gt;&amp;quot;'&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This feature is available in &lt;a href="http://msdn.microsoft.com/en-us/teamsystem/dd819231.aspx"&gt;Visual Studio Team System 2010 Beta 1&lt;/a&gt;. Feel free to download the beta and if you have any feedback on this feature, please leave me a comment.&lt;/p&gt;

&lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9856655" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Team+System+2010/default.aspx">Team System 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Code+Analysis/default.aspx">Code Analysis</category></item><item><title>Discover dead code in your application using Code Analysis</title><link>http://blogs.msdn.com/habibh/archive/2009/07/31/discover-dead-code-in-your-application-using-code-analysis.aspx</link><pubDate>Fri, 31 Jul 2009 16:04:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9854388</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9854388.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9854388</wfw:commentRss><description>&lt;p&gt;Last weekend, I spent a good 30 minutes trying to figure out why I wasn't hitting a breakpoint in a method. Admittedly, I wasn't very familiar with the code since I hadn't written it. It turned out that the method wasn't being called from anywhere, so it was essentially &amp;quot;dead code&amp;quot;. I wanted to remove the method in order to clean up the code but I wasn't 100% sure whether I would break anything. The only option was to use trial and error which meant that I commented out the method, rebuilt the code and ran through the scenario to verify that that the method was not being used. However, I still had a nagging feeling that maybe the code was being called through some other mechanism.&lt;/p&gt;  &lt;p&gt;Well, it turns out that you can use Code Analysis to take out much of the guess work with it comes to dealing with dead code. But first, a definition is in order.&lt;/p&gt;  &lt;h2&gt;What is &amp;quot;dead code&amp;quot; anyway?&lt;/h2&gt;  &lt;p&gt;There are several definitions of dead code including i) redundant code ii) unreachable code and iii) unused code. Code Analysis in Visual Studio Team System can tell you about the following types of dead code:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Private methods that are not called from any other code (CA1811) &lt;/li&gt;    &lt;li&gt;Unused local variables (CA1804) &lt;/li&gt;    &lt;li&gt;Unused private fields (CA1823) &lt;/li&gt;    &lt;li&gt;Unused parameters (CA1801) &lt;/li&gt;    &lt;li&gt;Internal classes that are not instantiated from any other code (CA1812) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In the sections below, I'm going to explain each of these types of dead code using real world examples.&lt;/p&gt;  &lt;h3&gt;Private methods that are not called from any other code (CA1811)&lt;/h3&gt;  &lt;p&gt;This type of dead code is pretty easy to understand. If you have a private method that is not called from anywhere inside your class, Code Analysis will warn you about it, as shown here:&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;warning : CA1811 : Microsoft.Performance : 'SearchData.NotifyPropertyChanged(string)' appears to have no upstream public or protected callers.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;In order to fix this issue, you can either add code to call the method or remove the method entirely. In the following example from the Patient Monitoring WPF sample application, the &lt;font face="Courier New"&gt;NotifyPropertyChanged&lt;/font&gt; private method is not called from any other code.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; NotifyPropertyChanged(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; propName)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (PropertyChanged != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;         PropertyChanged(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PropertyChangedEventArgs(propName));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h3&gt;Unused local variables (CA1804)&lt;/h3&gt;

&lt;p&gt;Typically, if you declare a local variable but don't assign anything to it, the compiler will warn you about it. However, if you do assign a value to the local variable, the compiler no longer complains &lt;em&gt;even if you never use the variable&lt;/em&gt;. Take a look at the following example from the WPF Patient Monitoring sample application which declares and initializes the local variable &lt;font face="Courier New"&gt;dob&lt;/font&gt; but never uses it. This could be a real bug that should be investigated further.&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; SeriesDataItem(SeriesDataItems itemParent, &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; itemValue)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     _itemParent = itemParent;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     DependencyObject dob = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DependencyObject();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.SetValue(SeriesDataItem.ValueProperty, itemValue);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Code Analysis will warn you about this type of dead code:&lt;/p&gt;

&lt;p&gt;&lt;font color="#ff0000"&gt;warning : CA1804 : Microsoft.Performance : 'SeriesDataItem.SeriesDataItem(SeriesDataItems, double)' declares a variable, 'dob', of type 'DependencyObject', which is never used or is only assigned to. Use this variable or remove it.&lt;/font&gt;&lt;/p&gt;

&lt;h3&gt;Unused private fields (CA1823)&lt;/h3&gt;

&lt;p&gt;In the example below, the field &lt;font face="Courier New"&gt;_filename&lt;/font&gt; is declared and initialized but it's not used anywhere in the assembly. Code Analysis will warn the developer with the following warning and also provides a suggestion as how to resolve the issue.&lt;/p&gt;

&lt;p&gt;&lt;font color="#ff0000"&gt;warning : CA1823 : Microsoft.Performance : It appears that field 'PatientVitals._filename' is never used or is only ever assigned to. Use this field or remove it.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;This type of warning could be a bug in the code that should be investigated further.&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; PatientVitals&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;  {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;      &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;readonly&lt;/span&gt; &lt;span style="color: #0000ff"&gt;char&lt;/span&gt;[] COMMA_SEPARATOR = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;char&lt;/span&gt;[] { &lt;span style="color: #006080"&gt;','&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;      &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, Waveform&amp;gt; _waveforms = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, Waveform&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;      &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; _filename;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;      &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; PatientVitals(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; filename)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;      {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;          &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._filename = filename;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;          &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ReadWaveformData(filename);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;      }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;      &lt;span style="color: #008000"&gt;// rest of class not shown&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h3&gt;Unused parameters (CA1801)&lt;/h3&gt;

&lt;p&gt;This type of dead code might actually be a symptom of a real bug in the code. In the following example, the parameter &lt;font face="Courier New"&gt;nextValue&lt;/font&gt; is not used anywhere inside the method. &lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ScrollPoints(&lt;span style="color: #0000ff"&gt;double&lt;/span&gt; nextValue)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     DrawSeries();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (_chartPoints.Count == _chartPoints.Capacity)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;         _chartClock.Controller.SkipToFill();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;         _chartClock.Controller.Begin();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;It's always worrisome when a parameter is passed to a method but never used. If you have this type dead code, code analysis will warn you about it. It should definitely be investigated further.&lt;/p&gt;

&lt;p&gt;&lt;font color="#ff0000"&gt;warning : CA1801 : Microsoft.Usage : Parameter 'nextValue' of 'Chart.ScrollPoints(double)' is never used. Remove the parameter or use it in the method body.&lt;/font&gt;&lt;/p&gt;

&lt;h3&gt;Internal classes that are not instantiated (CA1812)&lt;/h3&gt;

&lt;p&gt;This type of dead code is much less common than the other types mentioned above. If you declare an inner class but do not instantiate it, Code Analysis will warn you with the following message:&lt;/p&gt;

&lt;p&gt;&lt;font color="#ff0000"&gt;warning : CA1812 : Microsoft.Performance : 'Order.OrderItem' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static methods, consider adding a private constructor to prevent the compiler from generating a default constructor.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;In the following example, the inner class OrderItem is never instantiated from the Order class.&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Order&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; List&amp;lt;OrderItem&amp;gt; orderItems = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;OrderItem&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Order()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; OrderItem&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9854388" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Code+Analysis/default.aspx">Code Analysis</category></item><item><title>Debugging 101: How to skip over code in the Visual Studio Debugger</title><link>http://blogs.msdn.com/habibh/archive/2009/07/30/debugging-101-how-to-skip-over-code-in-the-visual-studio-debugger.aspx</link><pubDate>Thu, 30 Jul 2009 10:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9852986</guid><dc:creator>habibh</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9852986.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9852986</wfw:commentRss><description>&lt;p&gt;One of the questions that comes up regularly on newsgroups is &amp;quot;How do I skip over a section of my code in the Visual Studio debugger?&amp;quot; The answer depends on the meaning of the word &amp;quot;skip&amp;quot; but in general, there are three ways that you can skip over a section of code in the debugger. I'll describe these three techniques using the following code sample.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; DecrementUnitsInStock(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; quantity)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; success = Product.DecrementProductUnitsInStock(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ID, quantity);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (success)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.UnitsInStock -= quantity;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; success;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h2&gt;Step Over (F10)&lt;/h2&gt;

&lt;p&gt;Step Over (F10) is by far the most well known command for skipping over an entire method but still execute the function that you are stepping over. When you Step Over a line, it executes all method calls that are on that line (including methods that take other methods as their argument) and stop on the next line. However, if any of the methods that you are stepping over contain a breakpoint or throw an exception, the debugger will stop in the method.&lt;/p&gt;

&lt;p&gt;In the screenshot below, pressing F10 will execute the DecrementProductUnitInStock() method without tracing through it and will stop at the next line.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Step Over (F10)" border="0" alt="Step Over (F10)" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/Debugging101SkippingovercodeintheVisualS_96E7/image_23.png" width="759" height="190" /&gt; &lt;/p&gt;

&lt;h2&gt;Run To Cursor (CTRL+F10)&lt;/h2&gt;

&lt;p&gt;Think of &lt;strong&gt;Run To Cursor&lt;/strong&gt; as an &amp;quot;invisible one-shot breakpoint&amp;quot;. What does that mean exactly? It means that just like a breakpoint, the debugger will execute your application up to where your cursor is and break. In the following example, I placed my cursor on the line &amp;quot;return success&amp;quot; and pressed CTRL+F10. The debugger ran all the code up to (but excluding) the line &amp;quot;return success&amp;quot; and stopped.&lt;/p&gt;

&lt;p&gt;Run To Cursor is very useful when it comes to skipping over parts of a function that you don't want to step through. For example, if you have a loop in your method and you don't want to step through the loop, set your cursor just after the loop and select Run To Cursor (CTRL+F10).&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Run To Cursor (CTRL+F10)" border="0" alt="Run To Cursor (CTRL+F10)" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/Debugging101SkippingovercodeintheVisualS_96E7/image_17.png" width="714" height="172" /&gt;&amp;#160; &lt;/p&gt;

&lt;h2&gt;Set Next Statement (CTRL+SHIFT+F10)&lt;/h2&gt;

&lt;p&gt;Set Next Statement is a powerful debugging feature for controlling application execution, granted that it's used correctly. If used incorrectly, it can lead to all sorts of weird and wonderful behavior in your application. In a nutshell, Set Next Statement allows you to jump around in a method &lt;em&gt;without executing any code in between&lt;/em&gt;. In the code segment below, I moved the yellow arrow to the &amp;quot;return success&amp;quot; line which means that I skipped the execution of the &lt;font face="Courier New"&gt;if&lt;/font&gt; statement.&lt;/p&gt;

&lt;p&gt;Set Next Statement is frequently used in conjunction with edit and continue. That is, after changing some code during the debug session, you can set the next statement to the location before the change and re-execute the code to see the affect of your changes.&lt;/p&gt;

&lt;p&gt;Also, instead of using the shortcut CTRL+SHIFT+F10, you can drag the yellow arrow to the location in your code that you want to execute.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Set Next Statement (CTRL+SHIFT+F10)" border="0" alt="Set Next Statement (CTRL+SHIFT+F10)" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/Debugging101SkippingovercodeintheVisualS_96E7/image_26.png" width="714" height="172" /&gt; &lt;/p&gt;

&lt;p&gt;If you use other techniques to skip over code in the debugger, feel free to leave a comment.&lt;/p&gt;

&lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9852986" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category></item><item><title>Use UML Sequence Diagrams in Team System 2010 to reverse engineer your code</title><link>http://blogs.msdn.com/habibh/archive/2009/07/29/use-uml-sequence-diagrams-in-team-system-2010-to-reverse-engineer-your-code.aspx</link><pubDate>Wed, 29 Jul 2009 10:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9851711</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9851711.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9851711</wfw:commentRss><description>&lt;p&gt;One of the new features that we have added in Visual Studio Team System 2010 is the ability to create a new UML Sequence Diagram as well as generate one from existing code. I'm not going to go into too much detail on what a UML sequence diagram is since there is a plethora of information about the subject on &lt;a href="http://en.wikipedia.org/wiki/Sequence_diagram"&gt;Wikipedia&lt;/a&gt;. Instead, I'm going to walk you through an example on how to generate a sequence diagram for an existing application using Team System 2010.&lt;/p&gt;  &lt;p&gt;For this example, I'm going to use the BeerHouse sample application. BeerHouse contains a method (AddShoppingCartItem) which adds a product to the user's shopping code. The AddShoppingCartItem method is shown below.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult AddShoppingCartItem(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; productId, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt;? quantity)&lt;br /&gt;{&lt;br /&gt;    TheBeerHouseDataContext dc = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; TheBeerHouseDataContext();&lt;br /&gt;    ProfileBase profileBase = HttpContext.Profile &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; ProfileBase;&lt;br /&gt;    ShoppingCart shoppingCart = (ShoppingCart)profileBase.GetPropertyValue(&lt;span style="color: #006080"&gt;&amp;quot;ShoppingCart&amp;quot;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (shoppingCart == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;br /&gt;    {&lt;br /&gt;        shoppingCart = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ShoppingCart();&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #008000"&gt;// get the cheapest shipping method for our user&lt;/span&gt;&lt;br /&gt;        var cheapestShippingMethod = dc.ShippingMethods.GetShippingMethods().Cheapest();&lt;br /&gt;        shoppingCart.ShippingMethod = cheapestShippingMethod;&lt;br /&gt;&lt;br /&gt;        profileBase.SetPropertyValue(&lt;span style="color: #006080"&gt;&amp;quot;ShoppingCart&amp;quot;&lt;/span&gt;, shoppingCart);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    Product product = dc.Products.GetProduct(productId);&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;// throw a 404 Not Found if the requested forum is not in the database&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (product == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; HttpException(404, &lt;span style="color: #006080"&gt;&amp;quot;The product could not be found.&amp;quot;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;    ShoppingCartItem item = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ShoppingCartItem(product) {&lt;br /&gt;        Quantity = quantity ?? 1&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    shoppingCart.Add(item);&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; RedirectToAction(&lt;span style="color: #006080"&gt;&amp;quot;ViewShoppingCart&amp;quot;&lt;/span&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;You can certainly read through the code above to try and understand what it does. Alternatively, using a UML sequence diagram, you can visually see the sequence of calls within this method. To generate a sequence diagram, right-click anywhere inside the method (in this case AddShoppingCartItem) and select the &amp;quot;Generate Sequence Diagram&amp;quot; method, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Generate Sequence Diagram" border="0" alt="Generate Sequence Diagram" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/SequenceDiagramsinTeamSystem2010_65A5/image_3.png" width="807" height="311" /&gt; &lt;/p&gt;

&lt;p&gt;After selecting the &lt;em&gt;Generate Sequence Diagram&lt;/em&gt; command, the &amp;quot;Generate a Sequence Diagram&amp;quot; dialog appears, as shown below. The purpose of this dialog is to allow you to control the amount of information that is displayed on the diagram. There are essentially three knobs to control the amount of information that is generated on the diagram: call depth, scope, namespace.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Generate a Sequence Diagram" border="0" alt="Generate a Sequence Diagram" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/SequenceDiagramsinTeamSystem2010_65A5/image_20.png" width="325" height="294" /&gt; &lt;/p&gt;

&lt;p&gt;After clicking the [OK] button, the sequence diagram below is generated. It should be immediately clear how much easier it is to understand the sequence of method calls using the diagram instead of reading through the code.&lt;/p&gt;

&lt;p&gt;In the diagram below, you can see that there are five objects involved and how the objects interact with each other. Also, there is a section marked &lt;strong&gt;Opt &lt;/strong&gt;which stands for &amp;quot;optional&amp;quot; meaning that the sequence of calls within the &lt;strong&gt;Opt&lt;/strong&gt; section are dependent on some condition being true (in this case when &lt;font face="Courier New"&gt;shoppingCart == null&lt;/font&gt;).&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="UML Sequence Diagram" border="0" alt="UML Sequence Diagram" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/SequenceDiagramsinTeamSystem2010_65A5/image_21.png" width="795" height="904" /&gt; &lt;/p&gt;

&lt;h2&gt;Tips&lt;/h2&gt;

&lt;p&gt;Here are a few tips for using sequence diagrams.&lt;/p&gt;

&lt;h3&gt;Changing the default name of a sequence diagram&lt;/h3&gt;

&lt;p&gt;By default, the name of the sequence diagram that is generated is cryptic and not very friendly. You cannot change the name on the diagram itself. Instead, you have to use the Properties window to change the &lt;em&gt;Name&lt;/em&gt; property, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Sequence Diagram Properties" border="0" alt="Sequence Diagram Properties" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/SequenceDiagramsinTeamSystem2010_65A5/image_22.png" width="403" height="238" /&gt; &lt;/p&gt;

&lt;h3&gt;Adding a comment to a sequence diagram&lt;/h3&gt;

&lt;p&gt;It's often helpful to annotate sequence diagrams by adding comments. To add a comment, right-click on the sequence diagram and select Add –&amp;gt; Comment.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Add a comment to a sequence diagram" border="0" alt="Add a comment to a sequence diagram" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/SequenceDiagramsinTeamSystem2010_65A5/image_23.png" width="485" height="233" /&gt; &lt;/p&gt;

&lt;p&gt;As a last note, the ability to generate a UML sequence diagram is only supported for C# and VB.NET.&lt;/p&gt;

&lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9851711" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Team+System+2010/default.aspx">Team System 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category></item><item><title>Walkthrough: Measure the performance of your JScript code with Team System 2010</title><link>http://blogs.msdn.com/habibh/archive/2009/07/24/walkthrough-measure-the-performance-of-your-jscript-code-with-team-system-2010.aspx</link><pubDate>Fri, 24 Jul 2009 22:41:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9847811</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9847811.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9847811</wfw:commentRss><description>&lt;p&gt;In Visual Studio Team System 2010, one of the new features that we have added to the Profiler is the ability to measure the performance of JScript code that runs in the browser. This means that if you have a web application that contains ASP.NET AJAX or plain old JScript, you can now measure how long it takes to execute the JScript portion of the application. The main restriction with this feature is that it is only supported for Internet Explorer 8.&lt;/p&gt;  &lt;p&gt;In this walkthrough, I'm using the BeerHouse sample application. Specifically, I want to measure the performance of the &lt;strong&gt;UpdateProgress()&lt;/strong&gt; JScript function by figuring out how many times it is called. This function visually displays the current progress when a newsletter is sent to the list of subscribers. The body of UpdateProgress() is shown below.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; UpdateProgress(result, context) &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;    &lt;span style="color: #008000"&gt;// result is a semicolon-separated list of values, so split it&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; &lt;span style="color: #0000ff"&gt;params&lt;/span&gt; = result.split(&lt;span style="color: #006080"&gt;&amp;quot;;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; percentage = &lt;span style="color: #0000ff"&gt;params&lt;/span&gt;[0];&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; sentMails = &lt;span style="color: #0000ff"&gt;params&lt;/span&gt;[1];&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; totalMails = &lt;span style="color: #0000ff"&gt;params&lt;/span&gt;[2];&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;    &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (totalMails &amp;lt; 0)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;       totalMails = &lt;span style="color: #006080"&gt;'???'&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;    &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;    &lt;span style="color: #008000"&gt;// update progressbar's width and description text&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; progBar = window.document.getElementById(&lt;span style="color: #006080"&gt;'progressbar'&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;    progBar.style.width = percentage + &lt;span style="color: #006080"&gt;'%'&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; descr = window.document.getElementById(&lt;span style="color: #006080"&gt;'progressdescription'&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;    descr.innerHTML = &lt;span style="color: #006080"&gt;'&amp;lt;b&amp;gt;'&lt;/span&gt; + percentage + &lt;span style="color: #006080"&gt;'% completed&amp;lt;/b&amp;gt; - '&lt;/span&gt; +&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;       sentMails + &lt;span style="color: #006080"&gt;' out of '&lt;/span&gt; + totalMails + &lt;span style="color: #006080"&gt;' e-mails have been sent.'&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;    &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;    &lt;span style="color: #008000"&gt;// if the current percentage is less than 100%, &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;    &lt;span style="color: #008000"&gt;// recall the server callback method in 2 seconds&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (percentage == &lt;span style="color: #006080"&gt;'100'&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;       window.document.getElementById(&lt;span style="color: #006080"&gt;'panelcomplete'&lt;/span&gt;).style.display = &lt;span style="color: #006080"&gt;''&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;       setTimeout(&lt;span style="color: #006080"&gt;'CallUpdateProgress()'&lt;/span&gt;, 2000);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;And here is what the progress bar feature looks like.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Update Progress feature" border="0" alt="Update Progress feature" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/WalkthroughMeasuretheperformanceofyourAJ_E2A2/image_5.png" width="804" height="576" /&gt; &lt;/p&gt;

&lt;p&gt;To start collecting performance information about your application, select the &amp;quot;Launch Performance Wizard...&amp;quot; command from the &lt;strong&gt;Analyze&lt;/strong&gt; menu, as shown here.&lt;/p&gt;

&lt;p&gt;&lt;img title="Analyze menu" border="0" alt="Analyze menu" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/WalkthroughUsingtheTierInteractionProfil_10254/image_6.png" width="783" height="561" /&gt;&lt;/p&gt;

&lt;p&gt;Once the Performance Wizard comes up, select the &lt;strong&gt;Instrumentation&lt;/strong&gt; option and click [Next].&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Page 1 of the Performance Wizard" border="0" alt="Page 1 of the Performance Wizard" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/WalkthroughMeasuretheperformanceofyourAJ_E2A2/image_11.png" width="641" height="485" /&gt; &lt;/p&gt;

&lt;p&gt;On the second page of the Performance Wizard, you can select which application you want to profile. Since I am profiling the BeerHouse application and it's already open in Visual Studio, the Profiler will automatically select the project for me, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;img title="Select application to profile" border="0" alt="Select application to profile" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/WalkthroughUsingtheTierInteractionProfil_10254/image_12.png" width="641" height="535" /&gt;&lt;/p&gt;

&lt;p&gt;This next step is important! On the last page of the wizard, the checkbox to &amp;quot;Launch profiling after the wizard finishes&amp;quot; is checked. Uncheck it and click the [Finish] button.&lt;/p&gt;

&lt;p&gt;&lt;img title="Performance Wizard last page" border="0" alt="Performance Wizard last page" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/WalkthroughUsingtheTierInteractionProfil_10254/image_18.png" width="641" height="535" /&gt;&lt;/p&gt;

&lt;p&gt;After clicking the [Finish] button, Visual Studio will open the &amp;quot;Performance Explorer&amp;quot; window. In this window, under the &amp;quot;Targets&amp;quot; node, you can see the target application to be profiled . Right-click the target (in this case TBH_Web) and select Properties, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;img title="Target properties context menu" border="0" alt="Target properties context menu" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/WalkthroughUsingtheTierInteractionProfil_10254/image_21.png" width="725" height="521" /&gt;&lt;/p&gt;

&lt;p&gt;In the Properties dialog, select the &amp;quot;Instrumentation&amp;quot; tab and check the &amp;quot;Profile JavaScript&amp;quot; option. Press [OK] to dismiss the dialog.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Enable Profile JavaScript" border="0" alt="Enable Profile JavaScript" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/WalkthroughMeasuretheperformanceofyourAJ_E2A2/image_10.png" width="678" height="430" /&gt; &lt;/p&gt;

&lt;p&gt;Next, in the Performance Explorer window, click the &amp;quot;Launch with Profiling&amp;quot; toolbar button to start collecting performance data about your application. See below for a screenshot.&lt;/p&gt;

&lt;p&gt;&lt;img title="Start profiling" border="0" alt="Start profiling" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/WalkthroughUsingtheTierInteractionProfil_10254/image_thumb_8.png" width="209" height="270" /&gt;&lt;/p&gt;

&lt;p&gt;This will launch the BeerHouse application and start collecting performance data. In order to capture information about the UpdateProgress() function, I need to exercise the feature by creating a newsletter and sending it to the subscribers of the BeerHouse web site. After completing the scenario, exit the application which will cause the profiler to stop collecting additional information about the application.&lt;/p&gt;

&lt;p&gt;In the screenshot below, I've selected the &amp;quot;Call Tree&amp;quot; view to highlight information about the UpdateProgress() JScript function. As you can see from the screenshot, this function was called 12 times from the SendNewsletter.aspx page. The profiler not only shows how many times this function was called but also how long it took. Using this information, I can now make a decision as to whether to investigate this feature further or determine the performance is fine.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/WalkthroughMeasuretheperformanceofyourAJ_E2A2/image_14.png" width="805" height="602" /&gt; &lt;/p&gt;

&lt;p&gt;The steps shown in this walkthrough are applicable any time that you want to measure the performance of JScript code running in Internet Explorer 8. The JScript profiler feature is available as part of Visual Studio Team System 2010 Beta 1 which you can download from &lt;a href="http://msdn.microsoft.com/en-us/teamsystem/dd819231.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9847811" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Team+System+2010/default.aspx">Team System 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Performance+Tuning/default.aspx">Performance Tuning</category></item><item><title>The anatomy of the Historical Debugger Navigation Bar (Navbar)</title><link>http://blogs.msdn.com/habibh/archive/2009/07/23/the-anatomy-of-the-historical-debugger-navigation-bar-navbar.aspx</link><pubDate>Thu, 23 Jul 2009 23:52:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9846757</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9846757.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9846757</wfw:commentRss><description>&lt;p&gt;In a recent &lt;a href="http://channel9.msdn.com/shows/10-4/10-4-Episode-28-An-Introduction-to-the-Historical-Debugger/"&gt;Channel 9 10-4 &lt;/a&gt;video, Brian Keller introduced the Historical Debugger in Visual Studio Team System 2010. One of the features that he described in his video was the &lt;em&gt;Historical Debugger Navigation Bar (Navbar) &lt;/em&gt;which he used to &lt;em&gt;step back&lt;/em&gt; in the application.&lt;/p&gt;  &lt;p&gt;In this post, I'm going to describe in detail what the navigation bar does and how to use it. Let's start with a screenshot of what I mean by the navigation bar.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Historical Debugger Navigation Bar" border="0" alt="Historical Debugger Navigation Bar" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/TheanatomyoftheHistoricalDebuggerNavigat_13781/image_15.png" width="800" height="727" /&gt; &lt;/p&gt;  &lt;p&gt;The idea behind the Historical Debugger Navigation Bar is that you can use it to &amp;quot;time travel&amp;quot; through your application and go back and forward in your application to debug a problem. Think of it as the remote control for your Digital Video Recorder (DVR). You can &lt;em&gt;rewind&lt;/em&gt; and &lt;em&gt;fast forward&lt;/em&gt; as well as &lt;em&gt;skip&lt;/em&gt; to sections of your application that you want to debug. The following screenshot shows what the individual controls on the Navbar do and the corresponding shortcut keys.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/TheanatomyoftheHistoricalDebuggerNavigat_13781/image_7.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Historical Debugger Navigation Control" border="0" alt="Historical Debugger Navigation Control" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/TheanatomyoftheHistoricalDebuggerNavigat_13781/image_thumb_1.png" width="385" height="207" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You can download &lt;a href="http://msdn.microsoft.com/en-us/teamsystem/dd819231.aspx"&gt;Visual Studio Team System Beta 1&lt;/a&gt; which includes the Historical Debugger. I've included the following sample code below so that you can use it to play around with the Historical Debugger. I'm always eager to hear your feedback.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Program&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main()&lt;br /&gt;    {&lt;br /&gt;        Sphere earth = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Sphere();&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; earthRadius = 3956.6; &lt;span style="color: #008000"&gt;// miles&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; earthArea = earth.CalculateArea(earthRadius);&lt;br /&gt;        Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;The area of earth is {0} square miles&amp;quot;&lt;/span&gt;, earthArea);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Circle&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #008000"&gt;// Area = PI * (R) ^ 2&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; CalculateArea(&lt;span style="color: #0000ff"&gt;double&lt;/span&gt; radius)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; (Math.PI * Math.Pow(radius, 2));&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Sphere&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #008000"&gt;// Area = 4 * Area of Circle&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; CalculateArea(&lt;span style="color: #0000ff"&gt;double&lt;/span&gt; radius)&lt;br /&gt;    {&lt;br /&gt;        Circle c = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Circle();&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; (4 * c.CalculateArea(radius));&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9846757" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/habibh/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category><category domain="http://blogs.msdn.com/habibh/archive/tags/Historical+Debugger/default.aspx">Historical Debugger</category><category domain="http://blogs.msdn.com/habibh/archive/tags/VSTS+Developing/default.aspx">VSTS Developing</category></item></channel></rss>