Skip to content

Conversation

max-charlamb
Copy link
Member

@max-charlamb max-charlamb commented Dec 9, 2024

Contributes to #109426

Previously the cDAC version of GetMethodDescData would throw if a method is dynamic because fetching the managedDynamicMethodObject was not supported. The managedDynamicMethodObject is a small portion of the returned information for dynamic methods and is unused in both SOS and CLRMD.

Since it is a relatively large lift to access this field (on a CorLib bound managed object) I believe it is reasonable to leave this field blank for now. Due to compatibility with the legacy implementation we need to keep the return object the same so the field is zero'd out.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

Debug.Assert(data->GCInfo == dataLocal.GCInfo);
Debug.Assert(data->GCStressCodeCopy == dataLocal.GCStressCodeCopy);
Debug.Assert(data->managedDynamicMethodObject == dataLocal.managedDynamicMethodObject);
// managedDynamicMethodObject is not currently populated by the cDAC API and may differ from legacyImpl.
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the managedDynamicMethodObject field actually zero'ed? I don't see it anywhere. I'm not sure if you should rely on the client to zero it (like in dacprivate.h). It may not be enough i.e. CLRMD doesn't use that include file.

Copy link
Member Author

@max-charlamb max-charlamb Dec 9, 2024

Choose a reason for hiding this comment

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

I see. I wasn't sure if the return memory region would be zero'd to begin with, but that makes sense. I'll zero out the field to make sure it is always returned with 0.

@max-charlamb
Copy link
Member Author

/ba-g Build analysis blocked by #110285

@max-charlamb max-charlamb merged commit cf03276 into dotnet:main Dec 11, 2024
145 of 147 checks passed
hez2010 pushed a commit to hez2010/runtime that referenced this pull request Dec 14, 2024
* allow SOSDacImpl::GetMethodDescData to handle dynamic functions
* zero-out managedDynamicMethodObject as it is not being used and cDAC does not yet support fetching managed fields
@github-actions github-actions bot locked and limited conversation to collaborators Jan 11, 2025
@max-charlamb max-charlamb deleted the md-enable-dynamic branch June 10, 2025 16:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants