JetBrains Rider 2024.1 Help

Track objects (Mark/Unmark Object)

You can make the debugger keep track of specific objects even if they are out of the current context.

When the program is suspended by the debugger, you can assign a label to any object in the current context with Mark Object. After that, the object will be pinned until it is garbage-collected, or you remove the label with Unmark Object, or until you finish the debugger session.

In the example below, both book1 and book2 have the same title and the same presentation in the debugger views:

JetBrains Rider debugger: Tracking objects (Make Object ID)

So we marked book1 with the Kings_book label:

JetBrains Rider debugger: Tracking objects (Make Object ID)

Now, when the marked object appears in any context, the variable that holds it will be shown with the corresponding label. This comes in handy when there could be multiple similar objects, and you want to distinguish between them or when you track a specific object.

JetBrains Rider debugger: Tracking objects (Make Object ID)

Unless marked objects are garbage-collected, you can access them even if they are out of the current context using the Evaluate dialog Alt+F8 — just make sure that the program is suspended and use the object's label as if it were a local variable name:

JetBrains Rider debugger: Evaluating expression with a tracked object

Assign a label

  1. Select the desired variable in the Debug window.

  2. Press F11 or select Mark Object from the context menu. The Select object label dialog opens.

  3. Specify the label name. Use alphanumeric characters without spaces. Optionally, click Browse the Browse button next to the preview to change the label color.

  4. Click OK to assign the label.

Remove a label

  1. Locate the variable that holds the marked object in the Debug window.

  2. Press F11 or right-click the variable and select Unmark Object from the context menu.

Last modified: 11 February 2024