Lession 2 – SubExpression Breakpoints
Download the sample project – debugging.zip
It is possible to set breakpoionts in any of the 3 sections of the for loop below. As you know section "1" executes once at the beginning of the loop. Section "2" (the condition) executes once at the top of each for loop. Finally, section "3" executes once at the end of each loop.
So put your cursor any of the 3 sections and hit the "F9" key, the "Insert Breakpoint" command.
To clear the subexpression breakpoints
Using the BreakPoint Dialog Box – Just type in a name into the "New Breakpoint" Dialog Box
The beauty of it is that you can leverage the intellisense feature. Choose "Debug | New Breakpoint | Break at Function."
Be sure to have the "Use IntelliSense to verify the function name" selected. Notice in the example below that Visual Studio is complaining that we mis-spelled Callevenmore. The intellisense is protecting us.
If we spell things correctly, our breakpoint works.
If you have the same method in multiple classes, you can dis-ambiguate by preceding the method name with the class name as follows:
Note that the "MainForm" class name precedes "CallEvenMore."
But what if you have a function that is overloaded or in multiple classes?
Simple. Just type in that function name and a list will appear.
Notice that we can choose the one we wish to set a "BreakPoint" at. You could have narrowed the list by writing "Overload(int)."