Skip to content

Update dumpdelegate for .NET 11 layout - #5977

Merged
max-charlamb merged 2 commits into
dotnet:mainfrom
leculver:dumpdelegate
Aug 25, 2026
Merged

max-charlamb merged 2 commits into
dotnet:mainfrom
leculver:dumpdelegate

Conversation

@leculver

@leculver leculver commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • support the .NET 11 delegate helper-object and extra-data layout in !dumpdelegate
  • retain support for the legacy multicast invocation-list layout
  • distinguish multicast arrays from non-array helper objects before walking entries

Found through putting the new sos test harness through its paces, just a change in implementation in net 11.

Support both the legacy MulticastDelegate invocation-list fields and the new .NET 11 Delegate helper-object layout. Treat helper objects as multicast lists only when they are arrays with a valid element count, preserving single-target delegate output.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2bba76c7-c3b4-4774-84d5-6d21347e8ef8
Copilot AI lite review requested due to automatic review settings August 24, 2026 22:05
@leculver
leculver requested a review from a team as a code owner August 24, 2026 22:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates SOS !dumpdelegate to understand the .NET 11 delegate multicast layout changes while preserving legacy multicast handling, so delegate invocation lists can still be walked correctly across runtime versions.

Changes:

  • Adds support for reading multicast invocation data from either legacy _invocationList/_invocationCount or .NET 11 _helperObject/_extraData.
  • Adds a check to distinguish true multicast invocation-list arrays from non-array helper objects before iterating entries.
  • Refactors the command flow to either enqueue multicast entries for traversal or print single-target delegate target/method information.
Show a summary per file
File Description
src/SOS/Strike/strike.cpp Updates !dumpdelegate to handle .NET 11 multicast delegate layout while retaining legacy behavior and avoiding walking non-array helper objects.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Suppressed comments (1)

src/SOS/Strike/strike.cpp:2355

  • Same issue here: GetObjFieldOffset can return -1 on error, but != 0 will treat that as a valid offset and MOVE from an invalid address. Use > 0 before dereferencing.
                        if ((offset = GetObjFieldOffset(delegateObj.GetAddress(), delegateObj.GetMT(), W("_target"))) != 0)
                        {
                            MOVE(target, delegateObj.GetAddress() + offset);
                        }
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/SOS/Strike/strike.cpp Resolved
Treat GetObjFieldOffset failures as invalid instead of dereferencing the returned -1 offset. Apply the positive-offset check to both delegate layouts and the single-target fallback.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2bba76c7-c3b4-4774-84d5-6d21347e8ef8
leculver added a commit to leculver/diagnostics that referenced this pull request Aug 25, 2026
Keep the .NET 11 dumpdelegate product change isolated in dotnet#5977 rather than coupling it to the SOS test harness branch.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2bba76c7-c3b4-4774-84d5-6d21347e8ef8
@max-charlamb
max-charlamb merged commit 670d2b9 into dotnet:main Aug 25, 2026
25 checks passed
@leculver
leculver deleted the dumpdelegate branch August 25, 2026 19:51
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants