JetBrains Rider 2019.2 Help

Stepping through Code

While examining a suspended program, you get control over the program execution — by manually stepping through the program, you can advance the execution point to the code you are interested in.

When a program is running in the debug mode, there are two ways to suspend it:

  • Set breakpoints in the code that you want to examine and wait until one of them is hit.

  • Break program execution with Ctrl+Pause or Run | Pause Program. The debugger will finish the statement that is executing at the moment you pause, and then stop at the statement that should be executed next.

The current execution point — the next statement to be executed — is marked with a yellow execution pointer execution pointer in the left-hand gutter of the editor. To quickly find the current execution point, press Alt+NumPad * or click Show Execution Point icons debugger showCurrentFrame svg in the Debug window.

All stepping commands are available in the Run menu, via shortcuts, and with buttons on the Debug window toolbar:

JetBrains Rider: Stepping buttons on the Debug window toolbar

Below is a brief summary of all stepping commands.

Command

Icon

Shortcut

Use it to...

Step Intoicons actions traceInto svgF11

stop at the first statement of the first function called from the current line

Smart Step Intoicons debugger smartStepInto svgShift+F7

choose a function to step into if there are several calls in the current line

Step Outicons actions stepOut svgShift+F11

run the current function to the end and stop at the statement that follows the function call in the caller's context (or at the first breakpoint on the way, if any)

Step Overicons actions traceOver svgF10

execute the current statement and all functions that it calls, and then stop before the next statement (or at the first breakpoint on the way, if any)

Force Step Overicons debugger actions force step over svgShift+Alt+F8

step to the next statement as Step Over does, but also ignore all breakpoints in the called methods, if any

Run to Statement (Run to Cursor)icons actions runToCursor svgCtrl+F10

resume program execution and then stop before the target statement (or at the first breakpoint on the way, if any)

Force Run to Statement (Force Run to Cursor)icons debugger actions force run to cursor svgCtrl+Alt+F9

execute code until the target statement as Run to Statement (Run to Cursor) does, but also ignore all breakpoints on the way

Jump to Statement icon jump to statementCtrl+Shift+F10

make the target statement the next to be executed, skip all code between the current and the target statements

Step Into

When you need to debug a function called from the current line, you can step down into the call chain with the Step Into icons actions traceInto svg command F11 that is available in the Run menu and in the Debug window.

The debugger will set the execution pointer at the first statement of the first function called from the current line. If no function is called, then the debugger will step to the next statement.

By default, JetBrains Rider enables external-source debugging, which means that when you step into the library code it will be automatically decompiled and the debugger will move the execution point there.
If you want the debugger to ignore the library code, you can disable external-source debugging — Clear Enable external source debug on the Build, Execution, Deployment | Debugger page of JetBrains Rider settings Ctrl+Alt+S.

Smart Step Into

If the current line contains several nested calls, JetBrains Rider lets you choose a call to step into. Consider the following code line:

Console.WriteLine(Foo(Bar("input") + Baz("input")));
The line contains several calls and if you use Step Into, the debugger will first step into the implementation of Bar(), then into the implementation of Baz() and so on.

If you want to choose which of the calls should be stepped into, for example, Bar(), you can use Smart Step Into icons debugger smartStepInto svg Shift+F7:

JetBrains Rider: Smart step into - stepping into selected call

When you choose the function to step into, the debugger will set the execution pointer at the first statement of the selected function.
The selector also shows you which of the calls were already executed and allows you to execute these calls again.

Step Out

If you no longer want to debug a function (for example, the one you've just stepped into), use the Step Out icons actions stepOut svg command Shift+F11 that is also available in the Run menu and in the Debug window.

The debugger will execute the remaining lines of the function by itself and set the execution pointer at the statement following the function call.

Step Over

If you are not interested in how a particular function works, you can skip it over (the function will still be executed) — use the Step Over icons actions traceOver svg command F10 that is also available in the Run menu and in the Debug window.

Force Step Over

If a function you want to step over contains breakpoints, the debugger will stop on those breakpoints if the corresponding statements are executed. You can force the debugger to skip breakpoints inside the call chain with the Force Step Over icons debugger actions force step over svg command Shift+Alt+F8 that is also available in the Run menu and in the Debug window.

Run to Statement (Run to Cursor)

As an alternative to setting a breakpoint at a specific statement, resuming the program, and then waiting for the breakpoint to be hit, you can tell the debugger to just run to this statement with the Run to Statement icons actions runToCursor svg command Ctrl+F10 that is also available in the Run menu and in the Debug window.

If Show floating debugger actions is enabled on the Build, Execution, Deployment | Debugger page of JetBrains Rider settings Ctrl+Alt+S, you can hover the mouse over the target statement and then pick the corresponding action:

JetBrains Rider debugger: Run to statement with the hover action

If line numbers are displayed in the editor, and Click line number to perform run to cursor is enabled on the Build, Execution, Deployment | Debugger page of JetBrains Rider settings Ctrl+Alt+S, you can run to this line by clicking its line number.

JetBrains Rider debugger: Run to statement using the line number

Force Run to Statement (Force Run to Cursor)

If there are breakpoints between the current execution point and the target statement, you can force the debugger to skip these breakpoints with the Force Run to Statement icons debugger actions force run to cursor svg command Ctrl+Alt+F9 that is also available in the Run menu and in the Debug window.

Jump to Statement

Instead of running the program up to the target statement, you may want to skip a part of code without actually executing it (for example, to avoid a known bug or to repeat some routine). You can do this with the Jump to statement icon jump to statement command Ctrl+Shift+F10 that is also available in the Run menu and in the Debug window.

You can also jump to statement by dragging the execution pointer execution pointer with your mouse and dropping it to the target line:

JetBrains Rider: Dragging the execution pointer

If Show floating debugger actions is enabled on the Build, Execution, Deployment | Debugger page of JetBrains Rider settings Ctrl+Alt+S, you can hover the mouse over the target statement and then pick the corresponding action:

JetBrains Rider debugger: Setting the next statement with the hover action

Remember the following when you jump to another statement:

  • Statements between the old and the new execution points are not executed.

  • You can jump back, that is to a statement that was already executed. In this case the already executed statements are not undone.

  • It is impossible to set the next statement in another function.

Last modified: 18 October 2019