It’s a small but very powerful tip, especially helpful when you are debugging large code base. This is the concept of Conditional Breakpoints.
As the name itself suggests, it is setting the breakpoints which are hit, only when certain condition is met. It’s easy to implement as well. Create a new application and set a normal breakpoint.
So this will be hit every-time the Page_Load executes. This could be very annoying when you are debugging for a bug and this keeps on hitting this breakpoint. So let’s make it conditional. Simply put your mouse on the breakpoint, right click and select ‘Condition‘.
This will open up a window where we can define a condition to hit the breakpoint, only when the condition is met. Even you get the intellisense help for it.
See how the color of the breakpoint changes with a plus sign on it. Also, hover over it and you can see the details.
Now let’s run the application. First time, no breakpoint is hit. Press the button for postback and see the breakpoint gets executed.
Even you can set this condition to be on your variables or properties etc. you define in your code. So happy debugging now…!!!