Skip to content

ICorDebugProcess5::EnumerateGCReferences doesn't include finalizer queue references #129559

@noahfalk

Description

@noahfalk

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions