Pinning Watch Variables While Debugging Visual Studio 2010, Awesome Feature

Posted by Peter Kellner on December 08, 2010 · 2 mins read

I just have to blog about what a helpful feature this is that the VS team added in VS2010.  That is, as you are debugging, you can set a watch variable and pin it to your source code.  In previous versions, you needed to basically go through the hassle of setting conditional break points to do simple debugging or be prepared to do lots of mouse clicking.  In the latest version, all you have to do is click the little thumb tack icon and drag the variable to where you want to see it. Here is what your screen looks like.

 

image

The way I got here was to first hover over the variable I wanted to look at.

image

Then, expand the details and press the push pin with the red arrow pointing at it.

image

Pressing the push pin puts the variable on your desktop and lets you drag it where ever you want.  The other nice thing is it stays there after you close visual studio and bring it up again (for those of us that require more than one debugging session to find a problem).

A very nice feature!