views:

1200

answers:

2

Is it possible to list all references of an object, while debugging in Visual Studio. I am using C#. I am looking for something similar to what GC does during garbage collection.

+5  A: 

SOS can do this for you. It isn't integrated into the debugger, but you can attach it to your running process. You may find it helpful to use SOSAssist, rather than learning the console syntax. IIRC:

!dumpheap –type {type}
Marc Gravell
+1. Also, this link helped me get started with SOS for exactly this purpose: http://blogs.msdn.com/ricom/archive/2004/12/10/279612.aspx
Not Sure
Also see Tess Ferrandez's great debugging blog, e.g. http://blogs.msdn.com/tess/archive/2007/10/19/net-finalizer-memory-leak-debugging-with-sos-dll-in-visual-studio.aspx
Dave