In the previous post, you have seen how we can use Object ID during debugging to access any objects that are out of scope. This post talk about a bit extension of the same feature. You can also access these objects using the created Object ID ( Created from Watch Window) from the Immediate Window.
Must Read : You can track Out of Scope Objects by assigning an Object ID during debugging in Visual Studio
Consider you have following set of object and you have created an Object ID for the same – $1 .
Now, when it goes out of scope / or you closed the watch window and if you want to access the same in the Immediate Window, you can still access it.
Just type the Object ID associated with the object inside Immediate Window.
As you can see from the following screen shot, the current value of the “student” and you can access the old out of scope value in Immediate Window.
You can access any variables or methods from the object Id’s as ((ClassName)ObjectID#).Properties or ((ClassName)ObjectID#).Method(). As per our example we can access Roll for that Object as shown in below.
Hope this small tricks helps.
Pingback: Compelling Sunday – 17 Posts on Programming and QA
Pingback: Visual Studio, Debugging, Xamarin and Application Insights Tips & Tricks from Daily .NET Tips – February 2016 Links – Abhijit's World of .NET