This is a mirror of official site: http://jasper-net.blogspot.com/

How to track an object which is Out of Scope while Debugging ?

| Monday, October 25, 2010
In Mastering in Visual Studio 2010 Debugging article I have discussed about the basic of Object ID creation while debugging. I received some request from some readers to explain the use of “Make Object ID” in details. In this blog post I am going explain how we can track an Object which is already out of scope using by creating a Object ID while debugging.

By using “Make Object ID” option we are informing Visual Studio Debugger to keep track of that object no matter it’s within scope or out of scope for the current context.  We can create “Object ID” either from Locals, Autos or from Watch Windows. Object ID is a integer number followed by a pound (#) sign. When we create Object ID for an particular object, Visual Studio Debugger ( CLR Debugging Services )  use an integer value to uniquely identify the object. This “Object ID” allows you to get the object details even if it is out of scope.


Let’s explore this with the help of below code block
....
....
As per the above code we have a list of Student object. I will show you how we can create new object ID for any specific object and can track them even though went out of scope.

Creating Object ID
To make an Object Id, You have to view the object from Watch Window, then Right Click > Context Menu, select  “Make Object ID”.

1_thumb2.png?w=468&h=211

The watch window will display a number with the pound (#) sign .

2_thumb2.png?w=522&h=66

Read more: Abhijit's World of .NET

Posted via email from .NET Info

0 comments: