I have crash in my program, it is a visualizer for VS, so, it is very hard to debug it, i have tried to make dump and use WinDbg to study it, but it unsuccessful.
So, now i try to put my hands on that list programmatically, but i don't know how. Thanks.
I do not think that there is a way to get at the finalization queue via .NET's managed Framework Class Library (FCL). I suspect that if you want to do this programmatically instead of debugging with WinDbg, you (just like WinDbg and similar tools) will need to use the CLR's unmanaged debugging & profiling APIs towards that end.
Take a look at the
ICORDebugGCReferenceEnum
COM interface. You can retrieve on object of that type viaICorDebugProcess5::EnumerateGCReferences
:Each object returned by the enumerator has a field
type
. You might want to filter for objects where that field matches the valueCorGCReferenceType.CorReferenceFinalizer
.If you want to see if an object is in the finalization queue or the f-reachable queue, when you fire off WinDBG, first locate your object, using
dumpheap -stat
or any other command. After you find that objects address, you can use the!FinalizeQueue
which will output how many objects are finalizable in each generation, and how many objects are ready for finalization. The former is the finalization queue, the latter is the f-reachable queue.For example:
Now, you can see where your objects address space is in.
A great tutorial is available here