<?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>Aaron Lerch &#187; debugging</title>
	<atom:link href="http://www.aaronlerch.com/blog/category/debugging/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aaronlerch.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 10 Mar 2010 12:45:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Debugging UI</title>
		<link>http://www.aaronlerch.com/blog/2008/12/15/debugging-ui/</link>
		<comments>http://www.aaronlerch.com/blog/2008/12/15/debugging-ui/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 19:01:09 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[windows forms]]></category>

		<guid isPermaLink="false">http://www.aaronlerch.com/blog/2008/12/15/debugging-ui/</guid>
		<description><![CDATA[I&#8217;ve talked before about System.Threading.SynchronizationContext, as well as BeginInvoke/InvokedRequired/IsHandleCreated. In a multi-threaded Windows Forms application they can easily be mis-used, introducing difficult to find bugs.
One such not-so-subtle bug (application hang) is particularly nasty, and is described fairly well here. Distilled down, the application hangs, usually when the computer comes out of sleep mode, unlocks, or [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve talked before about <a href="http://www.aaronlerch.com/blog/2007/05/19/net-20-winforms-multithreading-and-a-few-long-days/">System.Threading.SynchronizationContext</a>, as well as <a href="http://www.aaronlerch.com/blog/2006/12/15/controltrifecta-invokerequired-ishandlecreated-and-isdisposed/">BeginInvoke/InvokedRequired/IsHandleCreated</a>. In a multi-threaded Windows Forms application they can easily be mis-used, introducing difficult to find bugs.</p>
<p>One such not-so-subtle bug (application hang) is particularly nasty, and is <a href="http://ikriv.com:8765/en/prog/info/dotnet/MysteriousHang.html">described fairly well here</a>. Distilled down, the application hangs, usually when the computer comes out of sleep mode, unlocks, or another similar event occurs. The hang happens in the firing of an event handler, called from &#8220;SystemEvents.OnUserPreferenceChanged&#8221;. The cause is that OnUserPreferenceChanged is trying to be super nice, and invoke the event in the appropriate context for each event subscriber. That means that if a Control subscribes to the event, the handler will be called on the UI thread. If user code (on a background thread) subscribes, the handler will be called on an arbitrary thread, etc. The problem occurs when, at some point in the past, a Form or Control was created on a background thread. The creation of the control &#8220;installed&#8221; a WindowsFormsSynchronizationContext as the current SynchronizationContext (this is default behavior). When OnUserPreferenceChanged attempts to Send (Invoke) to the appropriate thread context, it hangs because the WindowsFormsSynchronizationContext is on the wrong thread, and thus has no message pump with which to process messages.</p>
<p>Blah blah blah. Right now you&#8217;re thinking &#8220;Whatever dude, I&#8217;m a web developer, man, I&#8217;m just trying to fix this bug in that <strong>other</strong> jerk&#8217;s code.&#8221; Fair enough, you can read the linked post for more gory details. What you care about is the hard part. Well, hard for <em>web developers</em> anyway. <img src='http://www.aaronlerch.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  By the time the app hangs, it&#8217;s too late to find out where the problem occurred. In a medium-to-large application, how do you find the control that was created on the wrong thread? Here&#8217;s how to do it in a matter of seconds.</p>
<p><strong>1. Name your UI thread.</strong> If you&#8217;re not already doing this, it&#8217;s a good idea in general. I like to call mine &#8220;UI&#8221;, personally. In your &#8220;static void Main()&#8221; add this single line of code:</p>
<pre class="c#" name="code">Thread.CurrentThread.Name = "UI";</pre>
<p><strong>2. Set a breakpoint deep in the bowels of the BCL.</strong> What we want to do is cause our application to break when a WindowsFormsSynchronizationContext gets assigned to the current thread. I cracked open Reflector to look at the constructor for WindowsFormsSynchronizationContext:</p>
<p><img src="http://s3.amazonaws.com:80/aaronlerch.com/images/winforms_synccontext_ctor.png"></p>
<p>And I see that there&#8217;s a call to &#8220;Application.ThreadContext.FromCurrent()&#8221;. Close enough for government work, it&#8217;ll do for what I want. I didn&#8217;t feel like figuring out how to specify a constructor call when setting a breakpoint. (If you know how, leave a comment so we can all learn!) Add a breakpoint to that method call. In Visual Studio, go to the &#8220;Debug&#8221; &gt; &#8220;New Breakpoint&#8221; &gt; &#8220;Break at Function&#8230;&#8221; menu. In the &#8220;Function&#8221; area type the full path to the function: System.Windows.Forms.Application.ThreadContext.FromCurrent()</p>
<p><img src="http://s3.amazonaws.com:80/aaronlerch.com/images/new_breakpoint_threadcontext.png"></p>
<p>When you hit &#8220;OK&#8221; you&#8217;ll get a warning about IntelliSense not finding the specified location. Hit &#8220;Yes&#8221; to set the breakpoint anyway.</p>
<p><strong>3. Run your application.</strong> Depending on what version of Visual Studio you&#8217;re running, and whether you&#8217;ve got source-level debugging for the Framework turned on, you&#8217;ll either get the breakpoint on some code, or you&#8217;ll get this message box:</p>
<p><img src="http://s3.amazonaws.com:80/aaronlerch.com/images/no_source_code_msgbox.png"></p>
<p>It doesn&#8217;t matter, you can press &#8220;OK&#8221; or &#8220;Show Disassembly&#8221;, whatever floats your boat. Go to the &#8220;Call Stack&#8221; debugging window, right-click on the red breakpoint circle located at the top of the stack frame, and select &#8220;Breakpoint&#8221; &gt; &#8220;Filter&#8230;&#8221;</p>
<p><img src="http://s3.amazonaws.com:80/aaronlerch.com/images/breakpoint_filter.png"></p>
<p><strong>4. Add a filter to this breakpoint so that it only breaks when the current threads&#8217; name isn&#8217;t &#8220;UI&#8221;.</strong></p>
<p><img src="http://s3.amazonaws.com:80/aaronlerch.com/images/breakpoint_filter_non_ui_thread.png"></p>
<p>After you hit &#8220;OK&#8221;, continue running your application in the debugger. The first time a WindowsFormsSynchronizationContext is created and it&#8217;s not on the UI thread, BAM. There&#8217;s your problem, and there&#8217;s your stack trace allowing you to find the bad code.</p>
<p>This worked like a champ for me today, hopefully you have as much success with it too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlerch.com/blog/2008/12/15/debugging-ui/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Symbol Store Manager &#8211; open source and a beta release</title>
		<link>http://www.aaronlerch.com/blog/2007/12/30/symbol-store-manager-open-source-and-a-beta-release/</link>
		<comments>http://www.aaronlerch.com/blog/2007/12/30/symbol-store-manager-open-source-and-a-beta-release/#comments</comments>
		<pubDate>Sun, 30 Dec 2007 22:18:04 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Symbol Store Manager]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[powershell]]></category>

		<guid isPermaLink="false">http://www.aaronlerch.com/blog/2007/12/30/symbol-store-manager-open-source-and-a-beta-release/</guid>
		<description><![CDATA[A while ago I &#34;released&#34; the Symbol Server Transaction Manager. It was a binaries-only, quick-and-dirty GUI wrapper utility I wrote on top of the symstore.exe command-line tool, at the prompting of John Robbins. If you&#8217;re not familiar with Symbol Servers, symstore.exe, or John Robbins, get up to speed by reading John&#8217;s still-relevant 2002 Bugslayer article [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago I &quot;released&quot; the <a href="http://www.aaronlerch.com/blog/2007/09/01/symbol-server-transaction-manager/">Symbol Server Transaction Manager</a>. It was a binaries-only, quick-and-dirty GUI wrapper utility I wrote on top of the symstore.exe command-line tool, at the prompting of <a href="http://www.wintellect.com/cs/blogs/jrobbins/default.aspx">John Robbins</a>. If you&#8217;re not familiar with Symbol Servers, <a href="http://msdn2.microsoft.com/en-us/library/ms681417(VS.85).aspx">symstore.exe</a>, or John Robbins, get up to speed by reading John&#8217;s <a href="http://msdn.microsoft.com/msdnmag/issues/02/06/Bugslayer/">still-relevant 2002 Bugslayer article</a> in MSDN magazine, or taking his <a href="http://wintellect.com/CourseDetail.aspx?Course=30">Mastering .NET Debugging</a> class.</p>
<p>I got some good feedback on the utility, along with some additional feature requests that ran outside the bounds of what the symstore utility offered. That lead me to upgrade my project to include a full-fledged (well, almost) symstore <em>replacement</em>, plus the GUI manager utility.</p>
<p>I&#8217;ve published the project tonight on CodePlex as &quot;<a href="http://www.codeplex.com/PSSymbolStore">PSSymbolStore</a>&quot;, and I&#8217;ve released the initial 0.1 beta release.</p>
<p>So what did I add and what did I change?</p>
<h5>PowerShell</h5>
<p>PSSymbolStore is now founded on a set of PowerShell cmdlets that replace and extend symstore&#8217;s functionality. (<em>Almost</em>: I need some feedback about a few symstore features and how they might work in the PowerShell world. If you&#8217;re a symstore wizard &#8211; ahem, John &#8211; <a href="mailto:aaronlerch@gmail.com">drop me a line</a>.) The initial release includes the following cmdlets, along with full help, including examples:</p>
<ul>
<li><b>Add-Symbols</b> &#8211; Adds symbols to the symbol store </li>
<li><b>Get-Transaction</b> &#8211; Retrieves some or all of the transactions from a symbol store </li>
<li><b>Remove-Transaction</b> &#8211; Deletes transaction(s) from a symbol store </li>
<li><b>Lock-Transaction</b> &#8211; Locks transaction(s), preventing them from being deleted with the Remove-Transaction cmdlet </li>
<li><b>Unlock-Transaction</b> &#8211; Unlocks transaction(s), allowing them to be deleted with the Remove-Transaction cmdlet </li>
</ul>
<h5>Symbol Store Manager</h5>
<p>The Symbol Store Manager (formerly &quot;Symbol Server Transaction Manager&quot;) is basically the same from a UI perspective, but has been massively gutted. The internal changes (MVP pattern, PowerShell hosting, etc.) are all for the better as they fully enable unit testing, which is coming in a future release. I&#8217;m looking for feedback on the UI &#8211; what I can improve, etc. It&#8217;s really basic right now. I had started adding a search feature using <a href="http://www.shuffletext.com/Highlight/Default.aspx">ShuffleText&#8217;s Highlight</a> fuzzy search library, but didn&#8217;t have time to finish it the way I wanted so I&#8217;ve pushed it out to a future release.</p>
<p><a href="http://www.aaronlerch.com/files/blog/SymbolStoreManageropensourceandabetarele_13996/SymbolStoreManager.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="302" alt="Symbol Store Manager" src="http://aaronlerch.com.s3.amazonaws.com/images/SymbolStoreManager_thumb.png" width="500" border="0" /></a> </p>
<h5>vNext</h5>
<p>So what&#8217;s coming next? I&#8217;ve already mentioned unit tests and searching. I&#8217;m also kicking around some UI enhancements. Aside from those features, and finishing up some &quot;paperwork&quot; like installs, I don&#8217;t currently have a strong feature list. If you have ideas, please either post them as a comment here, or even better on the <a href="http://www.codeplex.com/PSSymbolStore">codeplex project site</a>. For example: would this be more useful as an MMC snap-in instead of a standalone application?</p>
<p><a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx">Download PowerShell</a> if you haven&#8217;t already, and give <a href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=PSSymbolStore&amp;ReleaseId=9441">PSSymbolStore 0.1 Beta</a> a whirl &#8211; I hope it&#8217;s useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlerch.com/blog/2007/12/30/symbol-store-manager-open-source-and-a-beta-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symbol Server Transaction Manager</title>
		<link>http://www.aaronlerch.com/blog/2007/09/01/symbol-server-transaction-manager/</link>
		<comments>http://www.aaronlerch.com/blog/2007/09/01/symbol-server-transaction-manager/#comments</comments>
		<pubDate>Sat, 01 Sep 2007 04:43:32 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[debugging]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.aaronlerch.com/blog/2007/09/01/symbol-server-transaction-manager/</guid>
		<description><![CDATA[Part of the recent Mastering .NET Debugging course I took covered setting up and using Microsoft&#8217;s Symbol Server technology &#8211; something that&#8217;s been around for a while, but yet many people don&#8217;t do it. While it&#8217;s incredibly useful to have a symbol server set up to contain operating system symbols (the LAN is faster than [...]]]></description>
			<content:encoded><![CDATA[<p>Part of the recent <a href="http://www.aaronlerch.com/blog/2007/08/31/mastering-net-debugging-with-john-robbins/">Mastering .NET Debugging course I took</a> covered setting up and using Microsoft&#8217;s <a href="http://msdn2.microsoft.com/en-us/library/ms680693.aspx">Symbol Server</a> technology &#8211; something that&#8217;s been around for a while, but yet many people don&#8217;t do it. While it&#8217;s incredibly useful to have a symbol server set up to contain operating system symbols (the LAN is faster than the web), it can also be useful to place your own builds on the symbol server, especially for larger or distributed teams. And, it&#8217;s trivially easy to set one up, since it&#8217;s just a file-based database all you need is an available shared directory with plenty of space. Microsoft includes the &#8220;symstore&#8221; utility which allows you to add your own symbols &#8211; it&#8217;s included with the Debugging Tools for Windows download&#8211;the same download that includes Windbg.</p>
<p>It&#8217;s easy to upload your builds to the symbol server using the command line. You execute a command like:</p>
<p><code>symstore add /r /f d:\builds\*.* /s \\symbol\ProductSymbols /t "Product Name" /v "Version string" /c "Comment"</code></p>
<p>(For full usage information run &#8220;symstore&#8221; with no arguments.)</p>
<p>The not-so-easy part of this process comes when managing previously uploaded versions of your symbols. <a href="http://www.wintellect.com/cs/blogs/jrobbins/default.aspx">John Robbins</a> suggested (and who am I to resist a challenge) that it would be great if somebody wrote a tool with some sort of UI that allowed users to select previous &#8220;transactions&#8221; and delete them. The only way to do that right now is by manually scanning the &#8220;history.txt&#8221; file located on the server&#8217;s share (in an &#8220;000admin&#8221; subdirectory) and pulling out the transaction id to delete by using in a &#8220;symstore del&#8221; command.</p>
<p>Way, way too manual.</p>
<p>So, dear reader, I give you my response to John&#8217;s challenge: <strong>Symbol Server Transaction Manager</strong>!</p>
<p><strong>UPDATE 1/4/2008:</strong> I&#8217;ve done a huge overhaul of the app, and released it as open source on CodePlex as the <a href="http://www.codeplex.com/PSSymbolStore">PSSymbolStore project. </a>Download the latest release there.</p>
<p>It makes the process much easier, I hope. Simply start the app, and press CTRL+O to open a symbol store. Note that in all my examples I&#8217;m using a local symbol store, &#8220;C:\symbols&#8221; &#8212; but in most cases you&#8217;ll be specifying a network path such as &#8220;\\symbols\ProductSymbols&#8221;.<br />
<a href="http://www.aaronlerch.com/files/blog/SymbolServerTransactionManager_249C/CropperCapture6.png" atomicselection="true"><img src="http://www.aaronlerch.com/files/blog/SymbolServerTransactionManager_249C/CropperCapture6_thumb.png" style="border-width: 0px" alt="CropperCapture[6]" border="0" height="312" width="500" /></a></p>
<p>Once you&#8217;ve opened a symbol store, you&#8217;ll see a list of existing transactions. Any transactions that have previously been deleted will not be shown. You can sort by any of the columns to help find the transactions you are looking for, such as all transactions older than 2 weeks.<br />
<a href="http://www.aaronlerch.com/files/blog/SymbolServerTransactionManager_249C/SymbolServerTransactionManager2.png" atomicselection="true"><img src="http://www.aaronlerch.com/files/blog/SymbolServerTransactionManager_249C/SymbolServerTransactionManager2_thumb.png" style="border-width: 0px" alt="Symbol Server Transaction Manager (2)" border="0" height="318" width="500" /></a></p>
<p>At this point, it&#8217;s as easy as highlighting the transactions you want and pressing &#8220;Delete&#8221;. Or you can right-click one or more items and use the context menu. If you haven&#8217;t refreshed your view (I didn&#8217;t code it to auto-refresh because of how long the operation might take), and try to re-delete a transaction, you&#8217;ll see an error message in <font color="#ff0000"><strong>red</strong></font>. In fact, any error will be shown in red. If you come across an error condition that shows up in <font color="#0000ff"><strong>blue</strong></font> (which indicates success), let me know.</p>
<p>Here&#8217;s an example of successfully deleting two transactions:<br />
<a href="http://www.aaronlerch.com/files/blog/SymbolServerTransactionManager_249C/SymbolServerTransactionManager3.png" atomicselection="true"><img src="http://www.aaronlerch.com/files/blog/SymbolServerTransactionManager_249C/SymbolServerTransactionManager3_thumb.png" style="border-width: 0px" alt="Symbol Server Transaction Manager (3)" border="0" height="322" width="500" /></a></p>
<p>And here&#8217;s an example of trying to immediately re-delete those same transactions (bad):<br />
<a href="http://www.aaronlerch.com/files/blog/SymbolServerTransactionManager_249C/SymbolServerTransactionManager4.png" atomicselection="true"><img src="http://www.aaronlerch.com/files/blog/SymbolServerTransactionManager_249C/SymbolServerTransactionManager4_thumb.png" style="border-width: 0px" alt="Symbol Server Transaction Manager (4)" border="0" height="322" width="500" /></a></p>
<p>You can press the &#8220;Refresh&#8221; button to update the view to match the server:<br />
<a href="http://www.aaronlerch.com/files/blog/SymbolServerTransactionManager_249C/SymbolServerTransactionManager5.png" atomicselection="true"><img src="http://www.aaronlerch.com/files/blog/SymbolServerTransactionManager_249C/SymbolServerTransactionManager5_thumb.png" style="border-width: 0px" alt="Symbol Server Transaction Manager (5)" border="0" height="318" width="500" /></a></p>
<p>That&#8217;s about it, pretty simple stuff, eh? There is one thing worthy of a special note. Because deleting transactions can be a fairly long-running operation, you can cancel it. The &#8220;Delete&#8221; button changes to &#8220;Cancel&#8221; if an operation is running. If you click &#8220;Cancel&#8221;, <strong>it will kill the currently executing instance of SYMSTORE, orphaning any remaining files in the transaction</strong>, and it won&#8217;t process any more transactions, if you had selected more than one. That&#8217;s just something to be aware of. Eventually maybe I&#8217;ll be smarter about cleaning up the files, but for now, cancel at your own risk. <img src='http://www.aaronlerch.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I welcome any feedback, if you find this tool useful, let me know! I&#8217;m happy to add any enhancements you can think of, too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlerch.com/blog/2007/09/01/symbol-server-transaction-manager/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>TIP: Set breakpoints without source code in Visual Studio 2005</title>
		<link>http://www.aaronlerch.com/blog/2007/08/31/tip-set-breakpoints-without-source-code-in-visual-studio-2005/</link>
		<comments>http://www.aaronlerch.com/blog/2007/08/31/tip-set-breakpoints-without-source-code-in-visual-studio-2005/#comments</comments>
		<pubDate>Fri, 31 Aug 2007 18:15:55 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[debugging]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://www.aaronlerch.com/blog/2007/08/31/tip-set-breakpoints-without-source-code-in-visual-studio-2005/</guid>
		<description><![CDATA[This was probably my favorite Visual Studio 2005 tip I learned in the Mastering .NET Debugging class I recently took. John Robbins is awesome.   This tip lets you set a breakpoint at any arbitrary location &#8211; no source code required! Think framework library, or 3rd party library, or any commonly called code (that [...]]]></description>
			<content:encoded><![CDATA[<p>This was probably my favorite Visual Studio 2005 tip I learned in the Mastering .NET Debugging class <a href="http://www.aaronlerch.com/blog/2007/08/31/mastering-net-debugging-with-john-robbins/">I recently took</a>. <a href="http://www.wintellect.com/cs/blogs/jrobbins/default.aspx">John Robbins is awesome.</a> <img src='http://www.aaronlerch.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  This tip lets you set a breakpoint at any arbitrary location &#8211; no source code required! Think framework library, or 3rd party library, or any commonly called code (that you don&#8217;t have source for) where you don&#8217;t want to set breakpoints on every single call into the code.</p>
<p>There are a couple of gotchas that have to be configured for this to work. I was scratching my head wondering why this didn&#8217;t work for me immediately, here&#8217;s why.</p>
<p><strong>First</strong>, make sure the &#8220;Just My Code&#8221; setting is turned OFF in the Visual Studio settings (Tools -&gt; Options -&gt; Debugging). In fact, just leave this setting off all the time &#8212; it sucks. <img src='http://www.aaronlerch.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <br /><a href="http://www.aaronlerch.com/files/blog/TIPSetbreakpointswithoutsourcecode_BA97/Options_3.png" atomicselection="true"><img height="297" alt="Options" src="http://www.aaronlerch.com/files/blog/TIPSetbreakpointswithoutsourcecode_BA97/Options_thumb_3.png" width="500" border="0"></a> </p>
<p><strong>Secondly</strong>, make sure you have a symbol path configured so you can load the appropriate symbols. <em>You must have symbols for the &#8220;source-less&#8221; code!</em> The symbol path/server is specified via an environment variable named &#8220;<a href="http://support.microsoft.com/kb/311503">_NT_SYMBOL_PATH</a>&#8220;. If you don&#8217;t have a symbol server configured (more on that in a later post) your environment variable will probably look like this: (see the previous link for the exact syntax)</p>
<p><code>_NT_SYMBOL_PATH = SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols</code></p>
<p>You can also configure symbols from within Visual Studio in the Tools -&gt; Options -&gt; Debugging -&gt; Symbols configuration:<br /><a href="http://www.aaronlerch.com/files/blog/TIPSetbreakpointswithoutsourcecode_BA97/Options2_3.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="301" alt="Options (2)" src="http://www.aaronlerch.com/files/blog/TIPSetbreakpointswithoutsourcecode_BA97/Options2_thumb_3.png" width="500" border="0"></a> </p>
<p>Now, start debugging your application (have it break on the first instruction of the app). This is especially important if Visual Studio hasn&#8217;t yet pulled down the symbols from the symbol server. Bring up the breakpoint window in Visual Studio (CTRL+B) and type in enough detail for the resolver to find the method/property you&#8217;re looking for. If you want to break on a property, be sure to use the method syntax for the property: &#8220;get_[propertyname]&#8221; or &#8220;set_[propertyname]&#8220;.<br /><a href="http://www.aaronlerch.com/files/blog/TIPSetbreakpointswithoutsourcecode_BA97/NewBreakpoint_3.png" atomicselection="true"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="New Breakpoint" src="http://www.aaronlerch.com/files/blog/TIPSetbreakpointswithoutsourcecode_BA97/NewBreakpoint_thumb_3.png" width="500" border="0"></a> </p>
<p>Hit OK, and, if you had &#8220;Use Intellisense to verify the function name&#8221; selected, press &#8220;Yes&#8221;:<br /><a href="http://www.aaronlerch.com/files/blog/TIPSetbreakpointswithoutsourcecode_BA97/MicrosoftVisualStudio_3.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="183" alt="Microsoft Visual Studio" src="http://www.aaronlerch.com/files/blog/TIPSetbreakpointswithoutsourcecode_BA97/MicrosoftVisualStudio_thumb_3.png" width="500" border="0"></a> </p>
<p>At this point, if your code calls the method or property, the debugger will break on it and take you to the Disassembly view. You can use the Call Stack window to traverse up to whatever point you care about. Notice also that in this example, &#8220;child&#8221; breakpoints were automatically set on all the overloaded methods for System.Console.WriteLine, automatically.<br /><a href="http://www.aaronlerch.com/files/blog/TIPSetbreakpointswithoutsourcecode_BA97/CropperCapture5_3.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="203" alt="CropperCapture[5]" src="http://www.aaronlerch.com/files/blog/TIPSetbreakpointswithoutsourcecode_BA97/CropperCapture5_thumb_3.png" width="500" border="0"></a> </p>
<p>This is an awesome trick, one that can save you loads of time! Thanks John! <img src='http://www.aaronlerch.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlerch.com/blog/2007/08/31/tip-set-breakpoints-without-source-code-in-visual-studio-2005/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mastering .NET Debugging with John Robbins</title>
		<link>http://www.aaronlerch.com/blog/2007/08/31/mastering-net-debugging-with-john-robbins/</link>
		<comments>http://www.aaronlerch.com/blog/2007/08/31/mastering-net-debugging-with-john-robbins/#comments</comments>
		<pubDate>Fri, 31 Aug 2007 16:39:21 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://www.aaronlerch.com/blog/2007/08/31/mastering-net-debugging-with-john-robbins/</guid>
		<description><![CDATA[I just completed Wintellect&#8217;s &#8220;Mastering .NET Debugging&#8221; 2-day online course, led by &#8220;Bugslayer&#8221; John Robbins.&#160;John is a debugging wizard! But everybody already knew that. It&#8217;s always amazing to watch an expert make something difficult look easy, and he certainly does that. For hours on end he &#8220;spewed&#8221; (in a good way) great information, tips, and [...]]]></description>
			<content:encoded><![CDATA[<p>I just completed <a href="http://www.wintellect.com/CourseDetail.aspx?Course=30">Wintellect&#8217;s &#8220;Mastering .NET Debugging&#8221;</a> 2-day online course, led by &#8220;<a href="http://www.google.com/search?q=bugslayer+site%3Amsdn.microsoft.com%2Fmsdnmag">Bugslayer</a>&#8221; <a href="http://www.wintellect.com/cs/blogs/jrobbins/default.aspx">John Robbins</a>.&nbsp;John is a debugging wizard! But everybody already knew that. It&#8217;s always amazing to watch an expert make something difficult look easy, and he certainly does that. For hours on end he &#8220;spewed&#8221; (in a good way) great information, tips, and best practice advice that will take me months to grok. And even then, I&#8217;ll still only comprehend a fourth of it.</p>
<p>It was an absolute&nbsp;pleasure to be under his tutelage, if even it was &#8220;virtual&#8221; and he&#8217;s already forgotten my name. <img src='http://www.aaronlerch.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  I do find that courses like this serve to not only help develop my specific skills in a particular area, but it really expands my understanding of .NET in general. I highly recommend the course, and it&#8217;s a bargain compared to in-house or off-site training. The online venue worked very well, with the only downside being that John moves so fast (he&#8217;s good!)&nbsp;that it was hard to get questions asked during their context</p>
<p>He presented a lot of undocumented tips and tricks, many of which were extremely cool. I&#8217;ll be posting a few of them in the near future, with full credit and respect to John as the source. He kept mentioning that he&nbsp;relies on these undocumented tips to make a living, but I have a sneaking suspicion that he&#8217;ll do just fine even if I give away one or two here for free. <img src='http://www.aaronlerch.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If I wanted to sum up the training, I would say there are two important concepts to embrace when it comes to debugging:</p>
<ol>
<li>Write fewer bugs. (Duh!) There are a lot of &#8220;best practices&#8221; that can be followed to help reduce or catch bugs in the development cycle instead of in a production environment.</li>
<li>Do everything possible to gather as much information as possible about the environment the&nbsp;moment a bug occurs. You need to know the state of the system, and anything else that can give you &#8220;context&#8221;. Data that can be &#8220;explored&#8221; is best (like memory dumps, etc).</li>
</ol>
<p>Oh, and with the training (and, I suspect, with <a href="http://www.microsoft.com/mspress/books/8650.aspx">John&#8217;s latest book</a>) you get literally a&nbsp;TON of code: tools, helpers, snippets, visual studio add-ins, etc. If you don&#8217;t take the class, at least buy the book (probably a must-read anyway, but I haven&#8217;t read it yet) to get all this great stuff&#8211;if it was freely available, it would be at the top of <a href="http://www.hanselman.com/tools/">Hanselman&#8217;s tools list</a>, I&#8217;m sure.</p>
<p>Thanks John!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aaronlerch.com/blog/2007/08/31/mastering-net-debugging-with-john-robbins/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
