Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DiagnosticMethodInfo.Create(Delegate) for valuetype methods #110782

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

MichalStrehovsky
Copy link
Member

Fixes #108688.

We actually have test coverage for this here:

StructForDiagnosticMethodInfoTests s = default;
yield return new object[] {
(Action)s.NonGenericMethod,
nameof(StructForDiagnosticMethodInfoTests.NonGenericMethod),
TestNamespace + nameof(StructForDiagnosticMethodInfoTests)
};
yield return new object[] {
(Action)s.GenericMethod<object>,
nameof(StructForDiagnosticMethodInfoTests.GenericMethod),
TestNamespace + nameof(StructForDiagnosticMethodInfoTests)
};

But hitting the bug requires not considering the method to be target of reflection. We root libraries tests due to xUnit. Reflection can deal with both boxed and unboxed entrypoints, stack trace metadata can't.

Cc @dotnet/ilc-contrib

Fixes dotnet#108688.

We actually have test coverage for this here:

https://github.com/dotnet/runtime/blob/ce9dd2ad46a4842f5cf0f03c4a30b4d29bd0b4cc/src/libraries/System.Diagnostics.StackTrace/tests/DiagnosticMethodInfoTests.cs#L137-L147

But hitting the bug requires not considering the method to be target of reflection. We root libraries tests due to xUnit. Reflection can deal with both boxed and unboxed entrypoints, stack trace metadata can't.
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thanks

@jkotas jkotas merged commit 78ede32 into dotnet:main Dec 17, 2024
94 checks passed
@MichalStrehovsky MichalStrehovsky deleted the fix108688 branch December 17, 2024 22:11
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants