Run To Cursor

The Run to Cursor command is useful when you are single stepping through your code and wish to jump over sections of code in your current method (such as a for loop) and continue single stepping from that new location.

The run to cursor command (Debug | Run To Cursor) allows you to run the program being debugging until execution reaches the location where the text cursor/caret is in the source viewer when the command was issued. The debugger may stop the program's execution at a location different than where the cursor is if the debugger encounters a breakpoint before the cursor location is reached. If execution does not reach the run to cursor location because the location is not in the control flow, the debuggee will continue running.

In other words, the run to cursor command can be considered similar to inserting a temporary breakpoint at the specified location that will remain at that location until execution passes over it. Thus, you will be unable to run execution to the cursor if the cursor is at an invalid breakpoint location.

Tip: If you find yourself deep within the call stack and wish to jump out of several method calls, double-click on the stack frame that you wish the execution point to be in and position the text caret in the source pane to be at the line following the method call. Choose Debug | Run To Cursor and the execution point will be at caret position unless a breakpoint was encountered in a higher stack frame or in another executing thread first.