Visual Studio 2010 – Pin the watch box in source window

To know the content of a particular variable during debugging, what we usually do is add it to the watch window or just hover the mouse over it and see the values as tool tip like window.

image

With Visual Studio 2010 You can pin this watch window in the source file like a notes. Whenever the data is changed, you can watch it instantly in the source file itself. Cool eh? See it here.

Start your Debugging

As you’re seeing above, hover the mouse on the required variable. Click on the pin button on the right end.

 

image

You can see close button to close the watch unpin button and expand button. You can also add the comments as you’re seeing above.

Once you step through debugging process, you can see this changing as below. if the data is updated, it will be displayed in red color.

image

 

It’s really cool when you’re watching the arrays.

image

You can selectively pin the array items and if necessary you can see the entire array as usual.

This can be moved from the current line of display. The blue color pin on the left side of the source window will move along and on hovering, it will display to which line this watch is attached with.

The interesting thing is that Visual Studio can remember your pins and can restore when you start over the debugging.

What the drawback I found in this, we can’t specify symbols for watch variables in this window. If it’s there, we do simple memory analysis and other handy display options easily.

This is a simple use case of this feature. It will be very handy in many critical debugging situations. For e.g. while working with multiple threads etc…

This entry was posted in Uncategorized. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>