Tracking objects (Make Object ID)
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 Make Object ID. After that, the object will be pinned and not garbage-collected until you remove the label with Remove Object ID or finish the debugger session.
If a variable has a marked object as a value, its label will be displayed with the Dollar sign (
$) in the Debug window views. In the example below
book1 is marked with the
Now, when the marked object appears in the same or other 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.
As marked objects are not garbage-collected, you can access them even if they are out of the current context using the Evaluate dialog (Shift+F9) — just make sure that the program is suspended and use the object's label prefixed with the Dollar sign as if it were a local variable name:
To assign a label
Select the desired variable in the Debug window.
Press Ctrl+K, K or select Make Object ID from the context menu. The Select object label dialog opens.
Specify the label name. Use alphanumeric characters without spaces. Optionally, click Browse next to the preview to change the label color.
Click OK to assign the label.
To remove a label
Locate the variable that holds the marked object in the Debug window.
Press Ctrl+K, K or right-click the variable and select Remove Object IDt from the context menu.