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, simply select another frame on the Frames pane.
Viewing variables values
You have several opportunities to view variables values.
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.
To navigate to the source code
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.
Note, that changed values are also displayed with a different color.
If, for some reason, you want to disable showing values inline with code, in the Debug tool window, click the Settings icon and turn off Show Values Inline.
Editing variables values
While the program is suspended, you can edit values of almost any variables. This may be convenient, for example, when you want to reproduce a particular context for the debugged function.
To edit a variable value
- In the Variables pane of the Debug tool window, select the desired variable.
- Do one of the following:
- Specify the new value and press Enter.
Comparing variables values
During debugging, you can compare variables values with the value in the clipboard. This may be especially helpful when debugging strings.
To compare a variable value with the clipboard
- In the Variables pane of the Debug tooll window, select the desired variable.
- Right-click the variable and select Compare Value with Clipboard on the context menu.
The comparison result will be displayed in the Differences viewer.
Tracking out-of-scope objects
To track an object
- Suspend program execution to get to the object in the desired scope.
- In the Variables pane of the Debug tool window, right-click the object variable and select Mark Object on the context menu.
- In the Select Label window, specify label name and its color.
- Add a watch to the Variables pane. When adding the watch, specify the name of the label created on the previous step.