ICorDebugProcess5::EnumerateGCReferences doesn't include finalizer queue references
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Description
During code review I noticed that we have missing functionality. The ICorDebugProcess5::EnumerateGCReferences API claims that it will provide a full set of GC roots but it doesn't enumerate the finalizer queue. The DacRefWalker type has a parameter `BOOL walkFQ` that implies it should support this but nothing reads the mWalkFQ variable it sets. There is also some code in DacRefWalker::Next() that would iterate using mFQCurr and mFQEnd but nothing sets those fields to non-NULL values so the loop body is dead code.
PR #129345 removed some of the dead code making the missing behavior more obvious.
### Reproduction Steps
I identified the issue from code review and didn't test a repro. I assume it could be reproed by writing a debugger using ICorDebug, attach to a process that has an object rooted by the finalizer queue, and then run ICorDebugProcess5::EnumerateGCReferences.
### Expected behavior
ICorDebugProcess5::EnumerateGCReferences would enumerate the object in the finalizer queue
### Actual behavior
ICorDebugProcess5::EnumerateGCReferences would not enumerate the object in the finalizer queue
### Regression?
Git history suggests this codepath has been dead for at least the entire time the source has been open and perhaps it never worked.
### Known Workarounds
_No response_
### Configuration
Any version of .NET Core, any OS, any architecture
### Other information
_No response_
Contributor guide
Research direction
Start at ICorDebugProcess5::EnumerateGCReferences and trace how DacRefWalker handles finalizer-queue traversal. Inspect mWalkFQ, mFQCurr, and mFQEnd, including the changes from PR #129345. Done means a debugger using the API enumerates objects rooted by the finalizer queue, with behavior checked against a process containing such an object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100