16

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.

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
Faisal Mansoor
  • 2,041
  • 1
  • 21
  • 25

1 Answers1

10

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,026,079
  • 266
  • 2,566
  • 2,900
  • 3
    +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 Apr 01 '09 at 22:00
  • 2
    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 Apr 01 '09 at 22:31