Tech Tock

Time is of the essence.

3 New Favorite Techniques in Visual Studio

Here’s 3 techniques in Visual Studio that have lately become favorites of mine.

Breakpoint Output Logging

In my previous post on output logging with breakpoints, my colleague Ken Overton, pointed out the existence of something that used to be called “TracePoints”.  I went looking for these mythical beasts and was pleasantly surprised to find the “When Hit” option for breakpoints.  It’s available in the breakpoint right click menu.

image

You can output text and variable values when the breakpoint is hit instead of stopping:

image

The logging will show in the Output Window.  On the downside, it slows down program execution speed, seemingly more than conditional and regular breakpoints.

Object ID

My colleague Andrei Kashcha, master extraordinaire of debugging techniques, shared this with me and I’m starting to use it regularly.  When you make an “object id” for a  class instance, its a globally available reference to that instance for debug inspection and can be used to breakpoint in a single instance or verify which instance you are looking at.

To “Make Object ID”, just select that in the watch window context menu for an initialized variable.

image

That instance can now be referenced globally as 1#:

image

And to breakpoint in just that instance, set a conditional breakpoint with the condition “this == 1#”:

image

ReSharper Class List Navigator

I see a lot of people using this, but its recently become my goto navigation method.  For those of us ReSharper fans (with standard R# key mappings), just press ctl-t and up pops a handy class navigator that supports filtered search with partial class name and Pascal Cased abbreviations such as AVLCN for AVeryLongClassName.

image

Advertisements

July 11, 2011 - Posted by | Uncategorized | , , , , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: