How to: Specify a Breakpoint Condition
This topic applies to:
Pro and Team
Does not apply
Command or commands hidden by default.
A breakpoint condition is an expression that the debugger evaluates when a breakpoint is reached. If the condition is satisfied, the debugger looks at the How to: Specify a Hit Count to determine whether to break (or execute another specified action).
The condition can be any valid expression recognized by the debugger. (See Expressions in the Debugger for details.)
If you set a breakpoint condition with invalid syntax, a warning message appears immediately. If you specify a breakpoint condition with valid syntax but invalid semantics, a warning message appears the first time the breakpoint is hit. In either case, the debugger breaks execution when the invalid breakpoint is hit. The breakpoint is skipped only if the condition is valid and evaluates to false.
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.
To specify a breakpoint condition
In the Breakpoints window, right-click the line containing a breakpoint glyph and choose Condition from the shortcut menu
In a source, Disassembly, or Call Stack, right-click a line containing a breakpoint glyph and choose Condition from Breakpoints in the shortcut menu.
In the Breakpoint Condition dialog box, enter a valid expression in the Condition box.
Choose is true if you want to break when the expression is satisfied or has changed if you want to break when the value of the expression has changed.
The debugger does not evaluate the expression until the first time the breakpoint is reached. If you choose has changed, the debugger does not consider the first evaluation of the condition to be a change, so the breakpoint will not be hit on the first evaluation.