JetBrains Rider 2024.3 Help

Watch variables and expressions

If you want to evaluate a number of variables or expressions in the context of the current frame, view all of them simultaneously, and follow changes of their values as you step through the program, you can create watches for them.

Values of watched variables and expressions are only visible when the application is suspended during a debug session and all involved variables are accessible in the current scope. Unlike evaluated expressions, watches are saved as a part of the solution and evaluated in the subsequent debug sessions.

All watches that you add appear at the top of the variables pane in the Debug window. If you want to have a watch displayed on a specific line in the editor, use inline watches.

Add a variable or expression to a watch

  1. Select an item to watch in one of the following ways:

    • Select one or more variables in the variables pane.

    • To create a watch with an expression similar to an existing watch, select that watch in the variables pane.

    • Select the evaluation result in the Result view of the Evaluate dialog,

    • Select a variable or an expression in the editor.

  2. Press Insert or right-click it and choose Add to Watches.

Write an expression to be watched

  1. Press Insert when the focus is in the Debug window, or right-click in the variables pane and choose Add New watch.

  2. A new watch with an editable expression appears in the variable pane. Write the desired expression and press Enter.

Edit or remove a watch

  1. To remove a watch, select it in the variables pane press Delete or right-click it and choose Remove Remove Watch.

  2. To edit the watch expression, select it in the variables pane press Enter or right-click it and choose Edit.

Inline watches

To watch the result of some expression right in the editor, next to a specific line of code, you can set up an inline watch. Inline watches are displayed similarly to the inline values, but they have the Show watches in Variables tab icon and remain active even after session restart:

JetBrains Rider: Inline watch

Add an inline watch

  • Click an inline value and then click Add as inline watch in the popup that opens. In the input field that appears, use the original variable to form an expression to watch.

  • Right-click at the end of the desired line and choose Add Inline Watch in the context menu. In the input field that appears, specify an expression to watch.

  • Right-click a variable or expression that you want to watch and choose Add Inline Watch in the context menu. An inline watch will be created for that variable or expression.

Edit and remove inline watches

  • Hover over an inline watch in the editor and then either click the icon to remove it, or click the watch value and then click Edit watch expression in the popup that opens.

  • Inline watches are also shown in the variables pane under the Inline Watches node. You can right-click watches there and use the context menu to remove them or edit their expressions.

Last modified: 28 June 2024