Here is the scenario:
I put a breakpoint at the beginning of a method that I want to debug…
- First, lets say I want to debug (step through) the first part of the code.
- Then, there is a while-loop which I’m not interested in debugging (so let’s skip to the code after the while-loop).
Is it possible to skip to the code after the while-loop with the debugging options?
I want to do something like this:
BreakPoint: MyMethod()
{
# First part of the code: Yes, I want to debug it.
# while-loop: No, I do not want to debug it.
# Second part of the code: Yes, I want to debug it too.
}
Right-click on the line of code you want to run to, and click “Run To Cursor”, or you can set a second breakpoint after the loop and just run.
Edit: You kind of asked two questions here. The method above will let you step over the whole loop, regardless of how many iterations it goes through. If you want to only go through the loop body 10 times, add a breakpoint on the last statement of the loop, right-click that line, click “Breakpoint”, then “Hit count”, then “break when hit count is equal to” and put 10 in the box that appears. This will pause the program after the loop executes 10 times (you will manually have to reposition the current statement), but will NOT break if the loop executes less than 10 times (add an additional breakpoint after the loop as I suggested above).