Skip to content

Using Visual Studio 2010’s Debugger PIN Feature

Updated: at 11:18 PM

One of the very cool new features in Visual Studio 2010 is the ability to “Pin” a variable you are watching, right in the place you want to see it.  It’s always been a hassle to have to add a “Watch” and keep track of it among all your other watch variables.  I guess I shouldn’t really complain because I’ve always really like the debug capabilities in Visual Studio, but I have to say, this new “Pin” is really nice.


So, let me explain by example. 

At the moment, I’m debugging the Silicon Valley Code Camp web site project and I’m checking a boolean I set called DoValidation.  I’m trying to figure out why it is changing, but first I have to figure out when.  So, I set a break point on the line as shown below:


Now, I hover over the variable I want to pin and press the little pin icon shown here:


I then see the following with my little watch window right in line with my code.


I can even click the little chevron under the pin and add a comment as I show next.


The nice thing is that this stays here just like your break point until you close it.  A very convenient feature.