JetBrains Rider enables you not only view values of separate variables, but also evaluate more complex expressions. For example, you can enter the following expression to identify whether a string contains a particular character:
Please note that the expression evaluation feature has a number of limitations:
- A method can be invoked within the Expression Evaluation dialog only if the debugger has stopped at a breakpoint, but has not been paused.
- Expression Evaluation can only be "single-level". In other words, if JetBrains Rider stops at a breakpoint within a method called from the Expression Evaluation, you cannot use the Expression Evaluation feature again.
To evaluate an arbitrary expression
- Open the Evaluate Expression dialog box in one of the following ways:
- Choose on the main menu.
- Press Alt+F8.
- To evaluate a specific variable, select it on the Variables pane of the Debug tool window, then choose or press Alt+F8.
- In the Expression field, type the expression in question or choose one of the previously evaluated expressions from the drop-down list.
If you have selected a specific variable on the Variables pane, this variable will be displayed in the Expression text box.
- Click the Evaluate button. The Result read-only field shows the evaluation output. If the specified expression cannot be evaluated, the Result field explains the reason.
Note that you can add the evaluated expression to a list of watches by pressing Ctrl+Shift+Enter in the Evaluate Expression dialog.