Did you know… You can set conditional breakpoints? - #239

This was tip #16 for my TechEd VS IDE Tips and Tricks talk.

I believe this has been around since 2005, but maybe the white ‘+’ is new for 2008?

When you only want to break under certain conditions, you can right-click on a breakpoint red circle (or go to the Breakpoints Window and bring up the context menu on a given breakpoint) and select Condition to bring up the dialog box for conditional breakpoints. 

Conditional Breakpoints on Context Menu

You’re given two options: break only when the specified expression is true or break only when the specified value has changed.  For this example, since I’m in a for loop, i’ll break when the value of i > 5.

breakpoint condition message box

You’ll notice that the breakpoint circle now has a red plus on it to indicate it is conditional.

conditional breakpoint icon

Technorati Tags: VS2005Tip,VS2008Tip