<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Professional Visual Studio &#187; Debugging</title>
	<atom:link href="http://www.professionalvisualstudio.com/blog/tags/debugging/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.professionalvisualstudio.com/blog</link>
	<description>Tips, Tricks, and Best Practices for professional .NET developers</description>
	<lastBuildDate>Sun, 15 Aug 2010 02:44:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Debugging Tip of the Week #7: The DebuggerNonUserCode and DebuggerStepperBoundary Attributes</title>
		<link>http://www.professionalvisualstudio.com/blog/2008/09/24/debugging-tip-of-the-week-7-the-debuggernonusercode-and-debuggerstepperboundary-attributes/</link>
		<comments>http://www.professionalvisualstudio.com/blog/2008/09/24/debugging-tip-of-the-week-7-the-debuggernonusercode-and-debuggerstepperboundary-attributes/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 14:52:35 +0000</pubDate>
		<dc:creator>Dave Gardner</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.professionalvisualstudio.com/blog/?p=162</guid>
		<description><![CDATA[We&#8217;re quickly approaching the last of the Debugger attributes in the System.Diagnostics namespace. After this week there are only two more to go, but don&#8217;t despair, because I&#8217;ve saved the best till last. However for now let&#8217;s take a look at the DebuggerNonUserCode and DebuggerStepperBoundary attributes. The DebuggerNonUserCode attribute has the same effect as using [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re quickly approaching the last of the Debugger attributes in the <code>System.Diagnostics</code> namespace. After this week there are only two more to go, but don&#8217;t despair, because I&#8217;ve saved the best till last. However for now let&#8217;s take a look at the <strong>DebuggerNonUserCode</strong> and <strong>DebuggerStepperBoundary</strong> attributes.</p>
<p>The <strong>DebuggerNonUserCode</strong> attribute has the same effect as using both the <a href="http://www.professionalvisualstudio.com/blog/2008/08/29/debugging-tip-of-the-week-5-the-debuggerhidden-attribute/">DebuggerHidden</a> and <a href="http://www.professionalvisualstudio.com/blog/2008/09/09/debugging-tip-of-the-week-6-the-debuggerstepthrough-attribute/">DebuggerStepThrough</a> attributes at the same time. In the default Visual Studio configuration, code marked with this attribute will appear as external code in the call stack as shown below. As with the DebuggerStepThrough attribute, breakpoints cannot be set in blocks of code marked with this attribute. Stepping through code will step into any code called by that block of code in the same way it does for the DebuggerHidden attribute.</p>
<p><img title="Call stack with DebuggerNonUserCode" src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/09/debuggernonusercode_applied.png" alt="Call stack showing the effect of the DebuggerNonUserCode attribute" /></p>
<p>Code that is marked with the DebuggerNonUserCode attribute will be visible in the call stack if you disable the Just My Code option under <em>Tools-&gt;Options-&gt;Debugger-&gt;Enable Just My Code (Managed Only)</em>.</p>
<p><strong>DebuggerStepperBoundary</strong> is probably the most obscure of all of the Debugger attributes, as it only comes into effect under quite specific conditions. It is used to avoid a misleading debugging experience that can occur when a context switch is made on a thread within the boundaries of the DebuggerNonUserCode attribute. It is entirely possible in this scenario that the next user-supplied code module stepped into may not actually relate to the code that was in the process of being debugged. To avoid this undesirable situation, the DebuggerStepperBoundary, when encountered under this scenario, will escape from stepping through code to running code.</p>
<p>As with all of the debugger attributes, both the DebuggerNonUserCode and DebuggerStepperBoundary attributes are ignored by the CLR and as such have no affect during normal execution. So you do not need to worry about any implications of leaving any of these attributes in place in production code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.professionalvisualstudio.com/blog/2008/09/24/debugging-tip-of-the-week-7-the-debuggernonusercode-and-debuggerstepperboundary-attributes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging Tip of the Week #6: The DebuggerStepThrough Attribute</title>
		<link>http://www.professionalvisualstudio.com/blog/2008/09/09/debugging-tip-of-the-week-6-the-debuggerstepthrough-attribute/</link>
		<comments>http://www.professionalvisualstudio.com/blog/2008/09/09/debugging-tip-of-the-week-6-the-debuggerstepthrough-attribute/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 23:07:40 +0000</pubDate>
		<dc:creator>Dave Gardner</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.professionalvisualstudio.com/blog/?p=151</guid>
		<description><![CDATA[The DebuggerStepThrough attribute is another of the debugger attributes that should be used carefully and only on well-tested code. Like the DebuggerHidden attribute, when the DebuggerStepThrough attribute is applied to a piece of code, that code is stepped over during debugging. Similar to the DebuggerHidden attribute, breakpoints cannot be set within a block of code [...]]]></description>
			<content:encoded><![CDATA[<p>The <strong>DebuggerStepThrough</strong> attribute is another of the debugger attributes that should be used carefully and only on well-tested code. Like the <a href="http://www.professionalvisualstudio.com/blog/2008/08/29/debugging-tip-of-the-week-5-the-debuggerhidden-attribute/">DebuggerHidden attribute</a>, when the DebuggerStepThrough attribute is applied to a piece of code, that code is stepped over during debugging.</p>
<p>Similar to the DebuggerHidden attribute, breakpoints cannot be set within a block of code marked with the DebuggerStepThrough attribute. However, within the call stack the attributed code will be marked as <em>external code</em>. For example, consider the following code snippet where the DebuggerStepThrough attribute has been set on <code>HiddenMethod</code>:</p>
<pre>private void ClickHandler(object sender, EventArgs e)
{
   HiddenMethod();
}

[DebuggerStepThrough()]
public void HiddenMethod()
{
   Console.WriteLine("Can't set a breakpoint here");
   NotSoHiddenMethod();
}

public void NotSoHiddenMethod()
{
   Console.WriteLine("Can set a breakpoint here!");
}</pre>
<p>If you run this code with a breakpoint set in <code>NotSoHiddenMethod</code>, the call stack will appear as shown below:</p>
<p><img title="Call stack with DebuggerStepThrough" src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/09/debuggerstepthrough_applied.png" alt="Call stack showing the effect of the DebuggerStepThrough attribute" /></p>
<p>Visual Studio 2008 supports the Just My Code option, configurable from the Debugging node in the Options dialog (select Tools &gt; Options). Unchecking this option makes all code contained within your application appear in the call stack, as shown below. This includes designer and other generated code that you might not want to debug. Once this option is unchecked, breakpoints can also be set in blocks of code marked with this attribute.</p>
<p><img title="Just My Code with DebuggerStepThrough" src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/09/debuggerstepthrough_justmycode.png" alt="Call stack showing the effect of the DebuggerStepThrough attribute combined with the Just My Code setting" /></p>
<p>DebuggerStepThrough is very useful when working with code that calls a lot of properties, for example, if you are calling a method that passes in a large number of properties as parameters. If you add the DebuggerStepThrough attribute to all the properties, and then you won’t step into all of the properties when debugging the method call.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.professionalvisualstudio.com/blog/2008/09/09/debugging-tip-of-the-week-6-the-debuggerstepthrough-attribute/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Debugging Tip of the Week #5: The DebuggerHidden Attribute</title>
		<link>http://www.professionalvisualstudio.com/blog/2008/08/29/debugging-tip-of-the-week-5-the-debuggerhidden-attribute/</link>
		<comments>http://www.professionalvisualstudio.com/blog/2008/08/29/debugging-tip-of-the-week-5-the-debuggerhidden-attribute/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 14:18:15 +0000</pubDate>
		<dc:creator>Dave Gardner</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.professionalvisualstudio.com/blog/?p=144</guid>
		<description><![CDATA[Continuing on with an exploration of the various debugger attributes found in the System.Diagnostics namespace, this week I&#8217;d like to present the DebuggerHidden attribute. This is something you probably only want to apply to VERY well tested code. Code marked with the DebuggerHidden attribute will be stepped over during debugging, and the method call will [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing on with an exploration of the various debugger attributes found in the System.Diagnostics namespace, this week I&#8217;d like to present the <strong>DebuggerHidden</strong> attribute.</p>
<p>This is something you probably only want to apply to VERY well tested code. Code marked with the DebuggerHidden attribute will be stepped over during debugging, and the method call will not even appear in the Call Stack window. However, if some code marked with this attribute makes a call to another method, the debugger steps into that method.</p>
<p>It&#8217;s also worth noting that any breakpoints that have been set in code marked with the DebuggerHidden attribute will be ignored. For example, in the following code snippet, a breakpoint can be set in both <code>ClickHandler</code> and <code>NotSoHiddenMethod</code>:</p>
<pre>private void ClickHandler(object sender, EventArgs e)
{
   HiddenMethod();
}

[DebuggerHidden()]
public void HiddenMethod()
{
   Console.WriteLine("Can't set a breakpoint here");
   NotSoHiddenMethod();
}

public void NotSoHiddenMethod()
{
   Console.WriteLine("Can set a breakpoint here!");
}</pre>
<p>If you step through this code, the debugger goes from the call to <code>HiddenMethod</code> in the <code>ClickHandler</code> method straight to the <code>NotSoHiddenMethod</code>. The call stack at this point is shown below, and you can see that <code>HiddenMethod</code> does not appear in the stack.</p>
<p><img title="Call stack with DebuggerHidden" src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/08/debuggerhidden.jpg" alt="Call stack showing the effect of the DebuggerHidden attribute" /></p>
<p>As with all of the System.Diagnostic attributes, the CLR will ignore this, so you will still see the method call in the stack trace of any an exceptions thrown at runtime.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.professionalvisualstudio.com/blog/2008/08/29/debugging-tip-of-the-week-5-the-debuggerhidden-attribute/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Debugging Tip of the Week #4: The DebuggerDisplay Attribute</title>
		<link>http://www.professionalvisualstudio.com/blog/2008/08/15/debugging-tip-of-the-week-4-the-debuggerdisplay-attribute/</link>
		<comments>http://www.professionalvisualstudio.com/blog/2008/08/15/debugging-tip-of-the-week-4-the-debuggerdisplay-attribute/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 11:50:46 +0000</pubDate>
		<dc:creator>Dave Gardner</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.professionalvisualstudio.com/blog/?p=125</guid>
		<description><![CDATA[Last week, we started to explore the first of the Debugger attributes that are found in the System.Diagnostics namespace by looking at the DebuggerBrowsable attribute. I&#8217;d like to continue that theme this week with the DebuggerDisplay attribute. No doubt you&#8217;ve seen that hovering your mouse over a variable while you are in Break mode will [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, we started to explore the first of the Debugger attributes that are found in the <code>System.Diagnostics</code> namespace by looking at <a href="http://www.professionalvisualstudio.com/blog/2008/08/07/debugging-tip-of-the-week-3-the-debuggerbrowsable-attribute/">the DebuggerBrowsable attribute</a>. I&#8217;d like to continue that theme this week with the <strong>DebuggerDisplay</strong> attribute.</p>
<p>No doubt you&#8217;ve seen that hovering your mouse over a variable while you are in Break mode will cause a tooltip to be displayed, which shows the type of object you are hovering over. You can see this below, where the datatip for a Customer object is shown.</p>
<p><img title="Default datatip for a Customer object" src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/08/debuggerdisplay_none.png" alt="Customer class with a default datatip" /></p>
<p>Unfortunately this information is not particularly useful, as most of the time you have a fairly good idea about the type of object you are dealing with. It would be better for this single line to contain more useful information about the object, as is the case with simple types such as strings or integers where the actual value is displayed.</p>
<p>This is where the DebuggerDisplay attribute comes in handy. It can be used to change this single line representation of the object from the default full class name. The attribute takes a single parameter, which is a String. The format of this string can include the { and } braces, which can contain a field, property, or method that returns a value.</p>
<p>For example, you could apply the DebuggerDisplay attribute to the Customer class as follows:</p>
<p><code>[DebuggerDisplay("Customer {CustomerName} has {Orders.Count} orders")]<br />
public class Customer</code></p>
<p>If you apply the attribute in this way, it will result in the following datatip:</p>
<p><img title="The datatip for the Customer class that has a DebuggerDisplay attribute" src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/08/debuggerdisplay_applied.png" alt="Customer class with DebuggerDisplay attribute" /></p>
<p>If you are a C# developer, then in addition to specifying properties and methods in the DebuggerDisplay format string, you can also include a general expression within the braces. For example, the following attribute shows how you could use an expression with a ternary operator:</p>
<p><code>[DebuggerDisplay("Customer {CustomerName} has orders? {(Orders.Count &gt; 0) ? \"Yes\" : \"No\"}")]</code></p>
<p>Which would result in the following datatip:</p>
<p><img src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/08/debuggerdisplay_expression.png" alt="Customer class showing datatip with DebuggerDisplay attribute expression" title="The datatip for the Customer class that has a DebuggerDisplay attribute with an expression" /></p>
<p>One final thing to note, in addition to Classes, the DebuggerDisplay attribute can be applied to any Struct, Delegate, Enumeration, Field, Property, or even an entire Assembly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.professionalvisualstudio.com/blog/2008/08/15/debugging-tip-of-the-week-4-the-debuggerdisplay-attribute/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Debugging Tip of the Week #3: The DebuggerBrowsable Attribute</title>
		<link>http://www.professionalvisualstudio.com/blog/2008/08/07/debugging-tip-of-the-week-3-the-debuggerbrowsable-attribute/</link>
		<comments>http://www.professionalvisualstudio.com/blog/2008/08/07/debugging-tip-of-the-week-3-the-debuggerbrowsable-attribute/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:10:23 +0000</pubDate>
		<dc:creator>Dave Gardner</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.professionalvisualstudio.com/blog/2008/08/07/debugging-tip-of-the-week-3-the-debuggerbrowsable-attribute/</guid>
		<description><![CDATA[In my latest instalment of the Debugging tip of the week, I&#8217;d like to introduce the debugging attributes. These handy attributes, found in the System.Diagnostics namespace, can be applied to your source code in order to control the way the debugger steps through it. Some of the debugging attributes can also be used to customise [...]]]></description>
			<content:encoded><![CDATA[<p>In my latest instalment of the Debugging tip of the week, I&#8217;d like to introduce the debugging attributes. These handy attributes, found in the <code>System.Diagnostics</code> namespace, can be applied to your source code in order to control the way the debugger steps through it. Some of the debugging attributes can also be used to customise the data tips that appear when you hover over a variable in Break mode, or view it in a Watch window.</p>
<p>The first attribute we will cover is the <code>DebuggerBrowsable</code> attribute. This attribute takes a <code>DebuggerBrowsableState</code> enumeration value as a parameter that determines how the member is displayed in the variable tree. In the following code snippet, the field Orders in the Customer class is set to Collapsed:</p>
<p><code>using System.Diagnostics;</code></p>
<p><code>public class Customer<br />
{<br />
&nbsp;&nbsp;&nbsp;[DebuggerBrowsable(DebuggerBrowsableState.Collapsed)]<br />
&nbsp;&nbsp;&nbsp;public List&lt;Order&gt; Orders;<br />
}<br />
</code><br />
Collapsed is the default DebuggerBrowsableState that you would normally see in Visual Studio. If you apply this to a member then it will be displayed, but not expanded by default, as shown below.</p>
<p><img src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/08/debuggerbrowsablestate_collapsed.png" alt="DebuggerBrowsableState.Collapsed" /></p>
<p>The following shows the same snippet with DebuggerBrowsable set to the RootHidden value. In this case the actual Orders item does not appear as a top-level entry in the data window, just the contents of the collection.</p>
<p><img src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/08/debuggerbrowsablestate_roothidden.png" alt="DebuggerBrowsableState.RootHidden" /></p>
<p>Finally, the Never value will hide the member completely from the data window. This can be quite useful if you want to hide your private properties. You can see the effect of this below, where the Orders member does not appear at all.</p>
<p><img src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/08/debuggerbrowsablestate_never.png" alt="DebuggerBrowsableState.Never" /></p>
<p>In .NET Framework 2.0, the <code>DebuggerBrowsable</code>  attribute is only interpreted by the C# debugger and has no effect when it is applied to Visual Basic code. This limitation has been removed in newer versions of the .NET Framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.professionalvisualstudio.com/blog/2008/08/07/debugging-tip-of-the-week-3-the-debuggerbrowsable-attribute/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Debugging Tip of the Week #2: Design-time Expression Evaluation</title>
		<link>http://www.professionalvisualstudio.com/blog/2008/07/31/debugging-tip-of-the-week-2-design-time-expression-evaluation/</link>
		<comments>http://www.professionalvisualstudio.com/blog/2008/07/31/debugging-tip-of-the-week-2-design-time-expression-evaluation/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 12:43:04 +0000</pubDate>
		<dc:creator>Dave Gardner</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.professionalvisualstudio.com/blog/2008/07/31/debugging-tip-of-the-week-2-design-time-expression-evaluation/</guid>
		<description><![CDATA[Last week I talked about how useful the Immediate Window is during debug-mode. A less-known, but totally awesome, feature of the Immediate Window is that it can be used at design-time to test/debug your code. This is particularly useful if you are working on a particular class or method that you want to test without [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I talked about how <a href="http://www.professionalvisualstudio.com/blog/2008/07/24/debugging-tip-of-the-week-1-the-immediate-window/">useful the Immediate Window is during debug-mode</a>. A less-known, but totally awesome, feature of the Immediate Window is that it can be used at design-time to test/debug your code. This is particularly useful if you are working on a particular class or method that you want to test <strong><em>without running the entire application</em></strong><em>.</em></p>
<p>The best way to understand this is to see it in action. The screenshot below shows a new Customer object being created in a C# project within the Immediate window.</p>
<p><img src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/07/designtimedebugging.png" alt="Design Time Expression Evaluation in the Immediate Window" /></p>
<p>When you declare a new object in the Immediate window at design-time, Visual Studio will create an instance of that object. However even though it has created this object, Visual Studio will remain in design-mode (For those that are interested, it actually uses the Object Test Bench in the background). If you invoke a method or property that contains an active breakpoint, Visual Studio will change to debug mode and break at the breakpoint. Once you resume execution from the break Visual Studio will return to design-mode.</p>
<p>There are a few gotcha&#8217;s and caveats that you need to be aware of when performing design-time expression evaluation.</p>
<p>Firstly, within a Visual Basic project you can’t use an explicit variable declaration (for example, <code>Dim myCust as Customer</code>). Instead variables are declared implicitly using the assignment operator (for example, <code>myCust = new Customer()</code>).</p>
<p>Secondly, if you are using C#, IntelliSense is not available in the Immediate window during design-time expression evaluation. Visual Basic programmers are a little more spoilt, as they are given a limited form of IntelliSense here.</p>
<p>Thirdly, any statements you enter into the Immediate Window will be evaluated against whatever project is selected in the Solution Explorer. If no project is selected,Visual Studio will evaluate it against the startup project. If the code doesn&#8217;t exist is that project, you will get an error.</p>
<p>Finally, you can&#8217;t use design-time expression evaluation in any project that  requires an execution environment. This includes Web projects, VSTO projects, Smart Device projects, and SQL projects. However as I mentioned earlier, the scope of this is per-project. Therefore, if you have a solution that contains a web project and a separate class library project for your business logic, you can use this method to test any of the business logic code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.professionalvisualstudio.com/blog/2008/07/31/debugging-tip-of-the-week-2-design-time-expression-evaluation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Debugging Tip of the Week #1: The Immediate Window</title>
		<link>http://www.professionalvisualstudio.com/blog/2008/07/24/debugging-tip-of-the-week-1-the-immediate-window/</link>
		<comments>http://www.professionalvisualstudio.com/blog/2008/07/24/debugging-tip-of-the-week-1-the-immediate-window/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 15:34:04 +0000</pubDate>
		<dc:creator>Dave Gardner</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.professionalvisualstudio.com/blog/2008/07/24/debugging-tip-of-the-week-1-the-immediate-window/</guid>
		<description><![CDATA[This post has been a long time coming, as I previously announced I would start this series following my user group presentation back in June. There&#8217;s a myriad of reasons why I let it go so long, however the impending release of Professional Visual Studio 2008 has kicked me into action. For the first of [...]]]></description>
			<content:encoded><![CDATA[<p>This post has been a long time coming, as I previously announced I would start this series following my <a href="http://www.professionalvisualstudio.com/blog/2008/06/03/debugging-tips-and-tricks/">user group presentation back in June</a>. There&#8217;s a myriad of reasons why I let it go so long, however the impending release of <a href="http://www.professionalvisualstudio.com/books/ProVS2008/">Professional Visual Studio 2008</a> has kicked me into action.</p>
<p>For the first of what will become an ongoing weekly series of debugging tips I&#8217;d like to start off with one of my favourite windows in the whole of Visual Studio &#8211; the Immediate Window. This useful window can be used during both debugging and at design-time. The window is displayed using the keyboard shortcut Ctrl+Alt+I, or by selecting it from the Debug-&gt;Windows menu. You can also type <code>immed</code> in the Command window and it will display and switch focus to the immediate window.</p>
<p>Quite often when you&#8217;re debugging an application, you&#8217;ll want to evaluate a simple expression either to test a bit of functionality or to remind yourself of how something works. This is one situation where the Immediate window comes in very handy. This window enables you to run expressions as you type them, as shown below.</p>
<p><img src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2008/07/immediatewindow.png" alt="The Immediate Window" /></p>
<p>To make life easier, the Immediate window supports IntelliSense, and you can use the arrow keys to track back through the history of previous commands executed.</p>
<p>The Immediate window also allows you to execute any Visual Studio command. To submit a command you must enter a greater than symbol &gt; at the start of the line. There is an extremely large set of commands available; in fact almost any action that can be performed within Visual Studio is accessible as a command. Fortunately IntelliSense makes navigating this list of available commands a little more manageable.</p>
<p><a href="http://www.professionalvisualstudio.com/blog/2007/10/22/do-you-have-an-alias-for-that/">Nick blogged last year about aliases</a>, which are available under both the Command and Immediate windows. One of the more well-known aliases is “?”, which is a shortcut for the Debug.Print command that prints out the value of a variable. As long as you have the Immediate window open, this is generally quicker and more convenient than bringing up a watch window, or hovering over a variable and waiting for the data tip to display.</p>
<p>If you start to become really dependant on the Immediate window for your debugging, you should consider enabling the option to <em>Redirect all Output window text to the Immediate window</em>. This option can be enabled under  Tools-&gt;Options-&gt;Debugging. Although the option says it redirects <strong><em>all </em></strong>Output window text, it will actually only redirect the debug messages (e.g. Debug.Print).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.professionalvisualstudio.com/blog/2008/07/24/debugging-tip-of-the-week-1-the-immediate-window/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Debugging Tips and Tricks</title>
		<link>http://www.professionalvisualstudio.com/blog/2008/06/03/debugging-tips-and-tricks/</link>
		<comments>http://www.professionalvisualstudio.com/blog/2008/06/03/debugging-tips-and-tricks/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 15:54:37 +0000</pubDate>
		<dc:creator>Dave Gardner</dc:creator>
				<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">http://www.professionalvisualstudio.com/blog/2008/06/03/debugging-tips-and-tricks/</guid>
		<description><![CDATA[Thursday evening I am presenting at my local .NET User Group on the topic of debugging. The title is &#8220;How to be a Debugging superhero&#8221;, and for the session I will be covering as many Visual Studio 2008 debugging tips, tricks, and best practices as I can fit into an hour. It should be a [...]]]></description>
			<content:encoded><![CDATA[<p>Thursday evening I am presenting at my <a href="http://perthdotnet.org/">local .NET User Group</a> on the topic of debugging. The title is <strong>&#8220;How to be a Debugging superhero&#8221;</strong>, and for the session I will be covering as many Visual Studio 2008 debugging tips, tricks, and best practices as I can fit into an hour. It should be a fun session (100% hands on) and I&#8217;ve also got a bunch of swag to give away, courtesy of the Microsoft <a href="http://www.heroescommunitylaunch.com/">Heroes {Community} Launch</a> program.</p>
<p>For those who can&#8217;t make it to sunny Perth for the session, as of next week I will be starting an ongoing, weekly series of blog posts covering all of the debugging tips and tricks that I can lay my hands on. I wrote 5 chapters on debugging in our upcoming <a href="http://www.professionalvisualstudio.com/books/ProVS2008/">Professional Visual Studio 2008</a> book, so there is plenty of material for me to draw from.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.professionalvisualstudio.com/blog/2008/06/03/debugging-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Debugging the .NET Framework source code</title>
		<link>http://www.professionalvisualstudio.com/blog/2007/12/11/debugging-the-net-framework-source-code/</link>
		<comments>http://www.professionalvisualstudio.com/blog/2007/12/11/debugging-the-net-framework-source-code/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 03:28:43 +0000</pubDate>
		<dc:creator>Dave Gardner</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.professionalvisualstudio.com/blog/2007/12/11/debugging-the-net-framework-source-code/</guid>
		<description><![CDATA[The last couple of days I&#8217;ve been exploring the .NET Framework source code. It&#8217;s been quite an enlightening experience peering under the hood and obtaining a better understanding of why certain things have been implemented in certain ways. Whilst we could always infer the programmers intent by using Reflector, there is no comparison to browsing [...]]]></description>
			<content:encoded><![CDATA[<p>The last couple of days I&#8217;ve been exploring the .NET Framework source code. It&#8217;s been quite an enlightening experience peering under the hood and obtaining a better understanding of why certain things have been implemented in certain ways. Whilst we could always infer the programmers intent by using Reflector, there is no comparison to browsing the actual source code, <strong>including the inline documentation</strong>. The really good news is that this documentation is quite comprehensive.</p>
<p><img src="http://www.professionalvisualstudio.com/blog/wp-content/uploads/2007/12/referencesourcedebugging.jpg" alt="Browsing the .NET Framework source code" /></p>
<p>A <a href="http://weblogs.asp.net/scottgu/archive/2007/12/08/december-8th-links-asp-net-asp-net-ajax-asp-net-mvc-net-vs-2008.aspx">recent post</a> by Scott Guthrie included information on how to request access to the source code. For some reason Scott has edited the blog post to remove this information, but if you look in the comments for this post you will find all the details you need to request access.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.professionalvisualstudio.com/blog/2007/12/11/debugging-the-net-framework-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
