<?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 : Debugging</title><link>http://blogs.msdn.com/habibh/archive/tags/Debugging/default.aspx</link><description>Tags: Debugging</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>One bug, two developers: Collaborative debugging is now a reality in Visual Studio 2010</title><link>http://blogs.msdn.com/habibh/archive/2009/12/01/one-bug-two-developers-collaborative-debugging-is-now-a-reality-in-visual-studio-2010.aspx</link><pubDate>Wed, 02 Dec 2009 00:51:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9931180</guid><dc:creator>habibh</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9931180.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9931180</wfw:commentRss><description>&lt;p&gt;Quite often, one or more developers need to collaborate on a bug to figure out the root cause of the problem. This collaboration is typically done using tools like email, bug tracking system (e.g. TFS) or if the developers are collocated, they might work on the bug together in one of their offices. Here is what the typical workflow 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="Collaborting on a bug" border="0" alt="Collaborting on a bug" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/OnebugtwodevelopersVisualStudio2010justm_ED81/image_27.png" width="846" height="472" /&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In the workflow above, when &lt;em&gt;Developer 1&lt;/em&gt; hands the bug over to &lt;em&gt;Developer 2&lt;/em&gt;, there is a lot of context and information that is left out and what usually happens is that Developer 2 restarts debugging the same issue to figure out the root cause. Basically, Developer 2 ends up doing a lot of redundant work that Developer 1 has already done. Ideally, Developer 2 should be able to leverage the investigation work that was done by Developer 1 and just continue the debugging session.&lt;/p&gt;  &lt;p&gt;In Visual Studio 2010, using two new features , i.e. &lt;em&gt;Breakpoint Import/Export&lt;/em&gt; and &lt;em&gt;DataTips Import/Export&lt;/em&gt; allows Developer 1 to hand off the debugging session to Developer 2 so that Developer 2 can just pick up where Developer 1 left off.&lt;/p&gt;  &lt;p&gt;Let's go through an example to see how this collaboration works. In this example, Developer 1 is investigating a bug in the &lt;strong&gt;Tailspin Toys&lt;/strong&gt; e-commerce sample application. He is trying to figure out why the Shopping Cart isn't updated when the user adds the same toy to the cart. After debugging the problem in Visual Studio, Developer 1 discovers that the bug is in a method (AdjustQuantity) that is in a component (Tailspin.Model) owned by Developer 2. The screenshot below shows where Developer 1 thinks the bug is.&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="AdjustQuantity bug" border="0" alt="AdjustQuantity bug" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/OnebugtwodevelopersVisualStudio2010justm_ED81/image_6.png" width="790" height="532" /&gt; &lt;/p&gt;  &lt;p&gt;At this point, Developer 1 wants to give this bug to Developer 2. However, rather than have Developer 2 do all the work to reproduce the bug, Developer 1 captures a couple of crucial pieces of information and sends them along with the bug to Developer 2. In a sense, Developer shares his debugging environment with Developer 2. First, Developer 1 exports his current breakpoint by right-clicking on the breakpoint in the editor and selecting the &amp;quot;Export…&amp;quot; command, as shown below. By exporting the breakpoint, Developer 2 can now easily figure out where to start investigating the bug.&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="Export Breakpoint context menu" border="0" alt="Export Breakpoint context menu" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/OnebugtwodevelopersVisualStudio2010justm_ED81/image_9.png" width="547" height="267" /&gt; &lt;/p&gt;  &lt;p&gt;The exported breakpoint file is 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="Exported Breakpoint File" border="0" alt="Exported Breakpoint File" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/OnebugtwodevelopersVisualStudio2010justm_ED81/image_12.png" width="800" height="390" /&gt; &lt;/p&gt;  &lt;p&gt;The next piece of information that Developer 1 wants to share with Developer 2 is what information Developer 2 should look at when debugging the problem. In order to do that, Developer 1 first &amp;quot;pins&amp;quot; the variable that he thinks is causing the bug to the editor, 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="Variable pinned to the editor" border="0" alt="Variable pinned to the editor" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/OnebugtwodevelopersVisualStudio2010justm_ED81/image_15.png" width="790" height="532" /&gt; &lt;/p&gt;  &lt;p&gt;After pinning the variable to the editor, Developer 1 exports the pinned variable, by selecting the Debug –&amp;gt; Export DataTips… command. The exported DataTips file is 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="Exported DataTips" border="0" alt="Exported DataTips" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/OnebugtwodevelopersVisualStudio2010justm_ED81/image_18.png" width="799" height="391" /&gt; &lt;/p&gt;  &lt;p&gt;Now, instead of Developer 2 restarting the investigation, he can continue where Developer 1 left off by importing the debugging environment. The new workflow is 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="Collaborative Debugging" border="0" alt="Collaborative Debugging" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/OnebugtwodevelopersVisualStudio2010justm_ED81/image_30.png" width="841" height="379" /&gt; &lt;/p&gt;  &lt;p&gt;To import the debugging environment, Developer 2 can import the DataTips file from Debug –&amp;gt; Import DataTips. The exported breakpoints can be imported from the Breakpoints window, 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="Import Breakpoints" border="0" alt="Import Breakpoints" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/OnebugtwodevelopersVisualStudio2010justm_ED81/image_33.png" width="576" height="240" /&gt; &lt;/p&gt;  &lt;p&gt;After importing both the breakpoint and the DataTips, Developer 2 can simply continue his investigation by pressing F5. The debugger will now stop at the breakpoint that Developer 1 exported and will show the variable as well. It will even show the comment that Developer 1 wanted to pass onto Developer 2. This is 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="Developer 2 Debugging View" border="0" alt="Developer 2 Debugging View" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/OnebugtwodevelopersVisualStudio2010justm_ED81/image_46.png" width="736" height="385" /&gt; &lt;/p&gt;  &lt;p&gt;If you have any feedback or suggestions on this feature or have any ideas on how to better collaborate when debugging, feel free to 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=9931180" 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></item><item><title>Looking for questions or feedback on IntelliTrace</title><link>http://blogs.msdn.com/habibh/archive/2009/10/26/looking-for-questions-or-feedback-on-intellitrace.aspx</link><pubDate>Tue, 27 Oct 2009 05:23:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9913336</guid><dc:creator>habibh</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9913336.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9913336</wfw:commentRss><description>&lt;p&gt;During the last few months, I've been blogging extensively about a new Visual Studio 2010 feature called IntelliTrace (formerly known as the &amp;quot;Historical Debugger&amp;quot;). We are very excited about IntelliTrace and think that it's going to change how people debug their applications.&lt;/p&gt;  &lt;p&gt;Since IntelliTrace is a brand new feature, we are eager to hear from developers about what they think about it. So, here is my offer: If you have any questions or feedback (both positive and negative) about IntelliTrace, send me your feedback via this blog and I will reply with an answer within 24 hours. Regardless of weather you've used IntelliTrace extensively and have an &amp;quot;advanced&amp;quot; questions, or you've never used it before and just want to learn about it, I'll be happy to answer any questions related to IntelliTrace.&lt;/p&gt;  &lt;p&gt;Thanks in advance.&lt;/p&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9913336" 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/IntelliTrace/default.aspx">IntelliTrace</category></item><item><title>Using IntelliTrace to view the return value of a VB or C# method</title><link>http://blogs.msdn.com/habibh/archive/2009/10/23/using-intellitrace-to-view-the-return-value-of-a-vb-or-c-method.aspx</link><pubDate>Sat, 24 Oct 2009 04:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9912785</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9912785.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9912785</wfw:commentRss><description>&lt;p&gt;A few months ago, I &lt;a href="http://blogs.msdn.com/habibh/archive/2009/06/10/how-to-view-the-return-value-of-a-c-or-vb-method-in-the-vs-debugger.aspx"&gt;blogged&lt;/a&gt; about how to view the return value of a C# or VB method in the Visual Studio debugger. As I explained in that blog post, the debugger does not support viewing the return value of a .NET method, so you have to apply a workaround or two.&lt;/p&gt;  &lt;p&gt;Being able to see the return value of a method comes in particularly handy when you have methods that take other methods as their parameters, e.g. F(A(x), B(y)), where A() and B() are methods themselves. For example, in the code example below, how can you see the value that is returned by c.CalculateArea(radius)?&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/UsingIntelliTracetoviewthereturnvalueofa_11CF7/image_5.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Return Value" border="0" alt="Return Value" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/UsingIntelliTracetoviewthereturnvalueofa_11CF7/image_thumb_1.png" width="1004" height="655" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;IntelliTrace in Visual Studio 2010 makes it easy to view the return value of a method.&lt;/p&gt;  &lt;p&gt;The first step is to change the default IntelliTrace options to record &amp;quot;events and call information&amp;quot;, 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="IntelliTrace Options" border="0" alt="IntelliTrace Options" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/UsingIntelliTracetoviewthereturnvalueofa_11CF7/image_8.png" width="862" height="578" /&gt; &lt;/p&gt;  &lt;p&gt;After enabling the above option, IntelliTrace will record the return value and parameters of all methods in the running application. Now, whenever you stop in the debugger, the IntelliTrace NavBar is displayed in the editor margin. To see the return value of a method, click the &amp;quot;Go to Previous Event&amp;quot; button (Ctrl+Shift+F11) to step back to the method that you want to see the value for, 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="IntelliTrace NavBar" border="0" alt="IntelliTrace NavBar" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/UsingIntelliTracetoviewthereturnvalueofa_11CF7/image_11.png" width="845" height="651" /&gt; &lt;/p&gt;  &lt;p&gt;After clicking the button, the debugger will display the method that you stepped back to in the Autos window, as shown in the following screenshot.&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="Debugger Autos window" border="0" alt="Debugger Autos window" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/UsingIntelliTracetoviewthereturnvalueofa_11CF7/image_14.png" width="846" height="727" /&gt; &lt;/p&gt;  &lt;p&gt;Expanding the method in the Autos window will display the return value. The debugger displays the name of the return value as &lt;strong&gt;[Return Value]&lt;/strong&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="Return Value in Autos window" border="0" alt="Return Value in Autos window" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/UsingIntelliTracetoviewthereturnvalueofa_11CF7/image_19.png" width="657" height="240" /&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9912785" 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/IntelliTrace/default.aspx">IntelliTrace</category></item><item><title>How to edit code when debugging a 64-bit application</title><link>http://blogs.msdn.com/habibh/archive/2009/10/12/how-to-edit-code-when-debugging-a-64-bit-application.aspx</link><pubDate>Tue, 13 Oct 2009 05:19:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9906445</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9906445.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9906445</wfw:commentRss><description>&lt;p&gt;One of the most popular features in the Visual Studio debugger is the ability to edit code during a debug session and have the changes apply without having to stop the debugger, recompile the application and then run the application to verify the changes. This feature is affectionately known as &amp;quot;Edit and Continue&amp;quot; or &amp;quot;E&amp;amp;C&amp;quot; for short.&lt;/p&gt;  &lt;p&gt;Unfortunately, Edit and Continue isn't supported on 64-bit. In fact, if you try to use Edit &amp;amp; Continue when debugging a 64-bit application, you get the following error message: &amp;quot;Changes to 64-bit applications are not allowed&amp;quot;, as shown below.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/9d46e66e51d6_13278/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="Edit and Continue dialog" border="0" alt="Edit and Continue dialog" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/9d46e66e51d6_13278/image_thumb_2.png" width="441" height="183" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Many users may not be aware that by default, when you create a C# or VB project in Visual Studio 2008, the &amp;quot;Platform&amp;quot; for the project is set to &amp;quot;Any CPU&amp;quot;. This means that if you run your application on a 32-bit operating system, your application will run as a 32-bit process and similarly, if you run your application on a 64-bit operating system, the application will be 64-bit. The consequence of &amp;quot;Any CPU&amp;quot; is that when you try to debug your application on a 64-bit operating system, you won't be able to use the Edit and Continue feature.&lt;/p&gt;  &lt;p&gt;However, there is a workaround. During development, you can set the Platform for your project to 32-bit which means that your application will run as a 32-bit process even on a 64-bit operating system. This is known as WOW64 or &amp;quot;Windows On Windows&amp;quot; which basically means that you can run a 32-bit application on a 64-bit operating system.&lt;/p&gt;  &lt;p&gt;So, how do you set the Platform for your project to 32-bit? Well, you need to create a 32-bit platform using the Visual Studio Configuration Manager. Here is a short walkthrough.&lt;/p&gt;  &lt;p&gt;First, open the &amp;quot;Configuration Manager&amp;quot; dialog from Build –&amp;gt; Configuration Manager. The Configuration Manager dialog is 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="Configuration Manager" border="0" alt="Configuration Manager" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/9d46e66e51d6_13278/image_12.png" width="720" height="451" /&gt; &lt;/p&gt;  &lt;p&gt;On the Configuration Manager dialog, select &amp;quot;New...&amp;quot; from the &amp;quot;Active solution platform&amp;quot; dropdown, as shown here.&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="Create New Platform" border="0" alt="Create New Platform" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/9d46e66e51d6_13278/image_15.png" width="710" height="441" /&gt; &lt;/p&gt;  &lt;p&gt;On the &amp;quot;New Solution Platform&amp;quot; dialog, select &amp;quot;x86&amp;quot; and press the OK button.&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 Solution Platform dialog" border="0" alt="New Solution Platform dialog" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/9d46e66e51d6_13278/image_18.png" width="353" height="229" /&gt; &lt;/p&gt;  &lt;p&gt;That's it! Your project is now compiled as a 32-bit application and therefore, it also runs as a 32-bit process.&lt;/p&gt;  &lt;p&gt;An important note to remember is that if you are planning to deploy your application to a 64-bit machine and you want the application to run as a 64-bit process, don't forget to set the project platform back to &amp;quot;Any CPU&amp;quot; and compile the project.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9906445" 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></item><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>Class Breakpoint: How to set a breakpoint on a C++ class in the Visual Studio Debugger</title><link>http://blogs.msdn.com/habibh/archive/2009/09/10/class-breakpoint-how-to-set-a-breakpoint-on-a-c-class-in-the-visual-studio-debugger.aspx</link><pubDate>Thu, 10 Sep 2009 21:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9893993</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9893993.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9893993</wfw:commentRss><description>&lt;p&gt;When debugging an application, there are times when you want the debugger to stop whenever any of the functions in a particular class are called. An example of this may be when you are trying to find out which object is calling your class. Of course, you could manually set a breakpoint on every function in your class but that is both tedious and time consuming, not to mention error prone (what if you miss one of the functions?)&lt;/p&gt;  &lt;p&gt;What you really want is a &amp;quot;class breakpoint&amp;quot;, that is, a breakpoint on an entire class and all its functions, operators, constructors, etc. In Visual Studio, you can set a &amp;quot;class breakpoint&amp;quot; using a function breakpoint. Specifically, when setting a function breakpoint, instead of specifying a function name, you can specify the name of the class followed by the '*' wildcard character. The '*' wildcard indicates to the debugger to break on &amp;quot;anything&amp;quot; that is called within the class.&lt;/p&gt;  &lt;p&gt;Let's go through an example. In the following class declaration, I want to set a breakpoint on all methods in the &lt;font face="Courier New"&gt;Stack&lt;/font&gt; 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;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;class&lt;/span&gt; Stack&lt;br /&gt;{&lt;br /&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt;:&lt;br /&gt;    list&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&amp;gt; m_list;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;:&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; push(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i);&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; pop();&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; depth() &lt;span style="color: #0000ff"&gt;const&lt;/span&gt;;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; empty() &lt;span style="color: #0000ff"&gt;const&lt;/span&gt;;&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;To do that, I can bring up the &amp;quot;New Breakpoint&amp;quot; dialog by pressing CTRL+B as shown below and type in &lt;font face="Courier New"&gt;Stack::*&lt;/font&gt; for the function name, 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 Breakpoint dialog" border="0" alt="New Breakpoint dialog" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/HowtosetaClassBreakpointinVisualStudio20_A2BD/image_9.png" width="588" height="261" /&gt; &lt;/p&gt;

&lt;p&gt;After setting the breakpoint, the Breakpoints window displays the new breakpoint just like any other breakpoint, as shown below.&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="Breakpoint on all functions" border="0" alt="Breakpoint on all functions" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/HowtosetaClassBreakpointinVisualStudio20_A2BD/image_6.png" width="634" height="230" /&gt; &lt;/p&gt;

&lt;p&gt;As soon as any of the functions in the Stack class are called, the debugger will stop at the function. Also, the Breakpoints window will show the fact that multiple breakpoints were set in the class. In the following screenshot, the function push() was called and the debugger stopped since there was a class breakpoint on the Stack class.&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="Class Breakpoint" border="0" alt="Class Breakpoint" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/HowtosetaClassBreakpointinVisualStudio20_A2BD/image_12.png" width="590" height="230" /&gt; &lt;/p&gt;

&lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9893993" 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></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>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>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>Quick Tip: How to move a breakpoint in the Visual Studio debugger</title><link>http://blogs.msdn.com/habibh/archive/2009/07/28/quick-tip-how-to-move-a-breakpoint-in-the-visual-studio-debugger.aspx</link><pubDate>Wed, 29 Jul 2009 04:38:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9851603</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9851603.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9851603</wfw:commentRss><description>&lt;p&gt;Setting a breakpoint in the Visual Studio debugger is as simple as placing your cursor on a line of code and pressing F9. However, once you've set the breakpoint, how do you move it to a different location since clicking on the breakpoint will delete it? One workaround is to delete the breakpoint and set a new breakpoint at the new location. The problem is, if you have set a bunch of options on the breakpoint, e.g. a condition, then those options will get lost in the move.&lt;/p&gt;  &lt;p&gt;The trick to moving a breakpoint is to use the &lt;em&gt;Breakpoint Location&lt;/em&gt; option to change the line number of the breakpoint. You can access the Location option by right-clicking on the breakpoint the you want to move and selecting &amp;quot;Location...&amp;quot;, as shown below.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Breakpoint Location" border="0" alt="Breakpoint Location" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/HowtomoveabreakpointintheVisualStudiodeb_10488/image_3.png" width="621" height="201" /&gt; &lt;/p&gt;  &lt;p&gt;On the File Breakpoint dialog, simply change the Line field to the new location and press [OK]. The breakpoint will move to the new location.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="File Breakpoint dialog" border="0" alt="File Breakpoint dialog" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/HowtomoveabreakpointintheVisualStudiodeb_10488/image_6.png" width="505" height="196" /&gt; &lt;/p&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9851603" 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></item><item><title>Walkthrough: Debug a WPF window or Windows Form without running your application [Video]</title><link>http://blogs.msdn.com/habibh/archive/2009/07/17/walkthrough-debug-a-wpf-window-or-windows-form-without-running-your-application-video.aspx</link><pubDate>Fri, 17 Jul 2009 10:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9838406</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9838406.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9838406</wfw:commentRss><description>&lt;p&gt;Most Windows GUI applications share a common trait. They all have multiple forms and/or dialogs. In the screenshot below, this simple application alone has four WPF windows.&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="Solution Explorer showing 4 WPF windows" border="0" alt="Solution Explorer showing 4 WPF windows" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/DebugaWPFwindoworWindowsFormwithoutrunni_FD38/image_3.png" width="313" height="375" /&gt; &lt;/p&gt;  &lt;p&gt;If I want to debug the main window, that's easy. I just press F5 and the main window or form starts up. However, if I want to debug one of windows or dialogs that are displayed as a result of clicking a button in my application, it requires me to i) start my main application and ii) click through various windows and dialogs until I get to the window that I'm interested in.&lt;/p&gt;  &lt;p&gt;This is both tedious and can be time consuming. There is a much easier way to debug a window or form, without having to start the debugger and clicking through the application.&lt;/p&gt;  &lt;p&gt;Watch the video below for a walkthrough.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="640" height="480"&gt; &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/vp09_06_22.xap" /&gt; &lt;param name="initParams" value="m=http://mschnlnine.vo.llnwd.net/d1/ch9/2/0/5/9/7/4/DebugOneForm_2MB_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://mschnlnine.vo.llnwd.net/d1/ch9/2/0/5/9/7/4/DebugOneForm_large_ch9.png, postid=479502" /&gt; &lt;param name="background" value="#00FFFFFF" /&gt; &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt; &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt; &lt;/a&gt; &lt;/object&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This feature is available for both C# and VB. Feel free to drop me a line if you are using this feature today.&lt;/p&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9838406" 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></item><item><title>Mixed Mode Debugging for 64-bit Applications</title><link>http://blogs.msdn.com/habibh/archive/2009/07/15/mixed-mode-debugging-for-64-bit-applications.aspx</link><pubDate>Wed, 15 Jul 2009 17:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9835707</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9835707.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9835707</wfw:commentRss><description>&lt;p&gt;In Visual Studio 2008 and earlier releases, one of the key complaints is that the debugger doesn't allow you to debug 64-bit mixed mode (managed and native) applications. In fact, if you try to debug a 64-bit mixed mode application, you will see an error that is similar to the following.&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;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;p&gt;---------------------------&lt;br /&gt;Microsoft Visual Studio&lt;br /&gt;---------------------------&lt;br /&gt;Error while trying to run project: Unable to start program '&amp;lt;application_path&amp;gt;'.&lt;/p&gt;&lt;p&gt;The debugger does not support debugging managed and native code at the same time on this platform.&lt;br /&gt;---------------------------&lt;br /&gt;OK &lt;br /&gt;---------------------------&lt;br /&gt;&lt;/p&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The only workaround is to debug the managed portion of the application using the managed debugger and similarly, debug the native portion using the native debugger.&lt;/p&gt;

&lt;p&gt;In Visual Studio 2010, we have removed this restriction such that you can use the Mixed Mode debugger for 64-bit applications. Hence, you will no longer see the above error message.&lt;/p&gt;

&lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9835707" 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></item><item><title>Debugging LINQ to SQL queries using the Historical Debugger</title><link>http://blogs.msdn.com/habibh/archive/2009/07/14/debugging-linq-to-sql-queries-using-the-historical-debugger.aspx</link><pubDate>Wed, 15 Jul 2009 00:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9835627</guid><dc:creator>habibh</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9835627.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9835627</wfw:commentRss><description>&lt;p&gt;I've covered the Visual Studio 2010 Historical Debugger extensively in a few of the previous posts. In this post, I'll cover how the Historical Debugger makes debugging LINQ to SQL queries a lot more convenient.&lt;/p&gt;  &lt;p&gt;If you are trying to debug a LINQ to SQL query, often it helps to look at the generated T-SQL code to get an understanding of what the query is trying to do. In the following example, I have a very simple query expression that returns a list of customers, ordered by their CustomerID.&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;Dim q =&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;From&lt;/span&gt; c &lt;span style="color: #0000ff"&gt;In&lt;/span&gt; db.Customers _&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;Order&lt;/span&gt; &lt;span style="color: #0000ff"&gt;By&lt;/span&gt; c.CustomerID _&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;Select&lt;/span&gt; c&lt;br /&gt;&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;Using the Historical Debugger, it's super easy to see what the underlying T-SQL query looks like. That's because the Historical Debugger records queries made to the database, as seen below.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Debug History window" border="0" alt="Debug History window" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/DebuggingLINQtoSQLqueriesusingtheHistori_14488/image_3.png" width="403" height="364" /&gt; &lt;/p&gt;

&lt;p&gt;To see the generated T-SQL query, you can use the Autos window, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Autos window" border="0" alt="Autos window" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/DebuggingLINQtoSQLqueriesusingtheHistori_14488/image_8.png" width="465" height="196" /&gt; &lt;/p&gt;

&lt;p&gt;Once you click the Visualizer button in the Autos window, you can see the entire T-SQL statement that is generated by the LINQ to SQL query expression.&lt;/p&gt;

&lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Debugger Text Visualizer" border="0" alt="Debugger Text Visualizer" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/DebuggingLINQtoSQLqueriesusingtheHistori_14488/image_11.png" width="404" height="404" /&gt; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9835627" 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>Fun with Breakpoints in the Visual Studio Debugger</title><link>http://blogs.msdn.com/habibh/archive/2009/07/13/fun-with-breakpoints-in-the-visual-studio-debugger.aspx</link><pubDate>Mon, 13 Jul 2009 15:15:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9831526</guid><dc:creator>habibh</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/habibh/comments/9831526.aspx</comments><wfw:commentRss>http://blogs.msdn.com/habibh/commentrss.aspx?PostID=9831526</wfw:commentRss><description>&lt;p&gt;Once in a while, I come across a feature in the debugger where I ask myself: &amp;quot;I wonder if anyone knows about this feature!&amp;quot;&lt;/p&gt;  &lt;p&gt;Yesterday, I came across just such a feature: Did you know that the debugger can play a sound when a breakpoint is triggered? Watch this short video and then continue reading to learn more.&lt;/p&gt;  &lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="640" height="480"&gt; &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/vp09_06_22.xap" /&gt; &lt;param name="initParams" value="m=http://mschnlnine.vo.llnwd.net/d1/ch9/8/1/4/8/7/4/FunVisualStudioBreakpoints_2MB_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://mschnlnine.vo.llnwd.net/d1/ch9/8/1/4/8/7/4/FunVisualStudioBreakpoints_large_ch9.png, postid=478418" /&gt; &lt;param name="background" value="#00FFFFFF" /&gt; &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt; &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt; &lt;/a&gt; &lt;/object&gt;  &lt;p&gt;You can configure Visual Studio to play a sound when a breakpoint is triggered via Windows Sounds, 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="Windows Sound dialog" border="0" alt="Windows Sound dialog" src="http://blogs.msdn.com/blogfiles/habibh/WindowsLiveWriter/CanyourVisualStudioDebuggerBreakpointdot_10FD/image_3.png" width="414" height="459" /&gt; &lt;/p&gt;  &lt;p&gt;I can think of three scenarios where developers would use this feature:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Developers who are visually impaired can use breakpoint sounds to know when a breakpoint is triggered &lt;/li&gt;    &lt;li&gt;A developer might have a scenario where it takes a long time to get to the point where the breakpoint is triggered. By binding a sound to the breakpoint, the developer can run the debugger and switch to other tasks. Once the breakpoint is triggered, the developer hears the sound and starts debugging the application. &lt;/li&gt;    &lt;li&gt;Some people just like customizing their applications. Take Outlook for example. I have run across numerous people who have changed the default sound for email notifications for Outlook. Why not customize breakpoints? &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;In the video above, I used Homer Simpson’s classic &amp;quot;Doh!&amp;quot; as the sound for when the breakpoint is hit, but ultimately, I couldn't decide what would be the perfect sound for when a breakpoint is triggered. What do you think? If you have any suggestions as to what sound a breakpoint should play, please leave your feedback. Also, let me know of other scenarios where breakpoint sounds would be useful.&lt;/p&gt;  &lt;p&gt;Habib Heydarian.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9831526" 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></item></channel></rss>