Advanced breakpoints and data inspections
Advanced breakpoints in Visual Studio 2022 are powerful tools that allow us to inspect and control the execution flow of their programs during debugging sessions.
Understanding the types of breakpoints
Breakpoints in Visual Studio can be divided into several types. Those are as follows.
Conditional breakpoints
We can control when a breakpoint executes by setting conditions. That feature has been available since Visual Studio 2005. We can right-click the breakpoint symbol and select Conditions, or right-click in the margin next to a line of code and select Insert Conditional Breakpoint from the context menu. In the Breakpoint Settings window, select Conditional Expression, Hit Count, or Filter, and set the conditional expression in the text box accordingly.
Figure 2.10 – Conditional breakpoint
In this example, with our setup, the debugger will stop if newQuantiy
is not equal to product.QuantityStock...