How to set conditional breakpoint in Visual Studio
To set conditional breakpoint, we can specify a breakpoint condition which will be evaluated when a breakpoint is reached. The debugger will break only if the condition is satisfied.
To specify a breakpoint condition, we can follow following steps:
1. In a source window, right-click a line containing a breakpoint glyph (round red circler in sidebar of visual studio) and choose Condition from Breakpoints in the shortcut menu.
2. In the Breakpoint Condition dialog box, define a boolean condition using the code in your local scope. For example, you can only break when _variablename = "break".
3. 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.
Click OK.
4. Run the code in debug mode and whenever breakpoint condition reach it will break on particular location.
Hope this helps to improve your productivity. Happy debugging :)