JetBrains Rider 2019.1 Help

Inspecting Variables

When the program is suspended, you can inspect variables and arguments in the context of the currently selected frame: view their values and edit them on the fly. To change the context, select another frame on the Frames pane.

Viewing variables values

There are several ways of viewing variables values.

Variables pane

The default way to examine variables values is use the Variables pane of the Debug window. Note that if a variable is of a complex type, you can expand the corresponding node in the pane to see values that the variable contains.

Sometimes, you may notice that some variables change their color. This happens when the variable value has changed since the last evaluation.

JetBrains Rider: updated variable highlighted in the Debug window

You can quickly navigate from a variable on the Variables pane to its declaration in the source code by pressing F4 or choosing Jump to Source from the context menu.

Inline with code

One more way to see variables values is to look at the code in the editor. By default, JetBrains Rider shows the values of variables at the end of the lines where these variables are declared.

JetBrains Rider debugger: Inline values in the editor

Note, that changed values are also displayed with a different color.

If for some reason, you want to disable showing values inline with code, disable Show Values Inline on the Build, Execution, Deployment | Debugger | Data Views page of JetBrains Rider settings (Ctrl+Alt+S).

Code tooltips

When Show value tooltip is enabled on the Build, Execution, Deployment | Debugger | Data Views page of JetBrains Rider settings (Ctrl+Alt+S), you can hover the mouse over variables to see their values. If the value of a variable or an expression contains child elements, clicking the Add button expands the node and displays all children.

JetBrains Rider: Value tooltips for variables when debugging

Function return values

The editor and the Variables pane will display the return value of any function that is called. This is useful when the result of a method call is not stored in a local variable, for example when just returning another function’s return value or when using method chaining.

JetBrains Rider debugger: Function return values

Editing variables values (Edit and continue)

You can also edit your code and continue debugging without restarting. The project will recompile in the background. This works in projects targeting .NET Framework and .NET Core on Windows (except WPF) when Enable Edit And Continue is ticked on the Build, Execution, Deployment | Debugger page of JetBrains Rider settings (Ctrl+Alt+S).

There are cases when modifying the code is not possible and a restart is required. These include changing signatures, modifying generic functions, renamings of any kind, and some more. If this happens JetBrains Rider will make you aware by showing a tooltip.

So you can either change code in the editor or edit variable values in the Debug window. This may be convenient, for example, when you want to reproduce a particular context for the debugged function.

To edit a variable value

  1. In the Variables pane of the Debug tool window, select the desired variable.

  2. Do one of the following:

    • Press F2.

    • Right-click the variable and select Set Value... from the context menu.

  3. Specify a new value and press Enter.

Comparing variables values

During debugging, you can compare variable values with the value in the clipboard. This may be especially helpful when debugging strings.

To compare a variable value with the clipboard

  1. In the Variables pane of the Debug tool window, select the desired variable.

  2. Right-click the variable and choose Compare Value with Clipboard from the context menu.

The comparison result will be displayed in the Differences viewer.

Last modified: 10 July 2019