-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 MethodInfo Emit for generic interfaces #40587
Fix MethodInfo Emit for generic interfaces #40587
Conversation
Signature generation now includes CustomModifiers MethodBuilder and ConstructorBuilder passes their SignatureHelper for generation Fixes dotnet#25958
Mono tests are failing:
|
Hmm, it's failing the test I added. But I'm not sure how to go about debugging the reflection on mono |
@marek-safar can you provide pointers to @wzchua on Mono? Thanks |
sigHelp = GetMemberRefSignature(method, cGenericParameters); | ||
} | ||
|
||
if (optionalParameterTypes is {} && optionalParameterTypes.Length > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can change this to if (optionalParameterTypes?.Length)
|
||
public sealed class WithIn : IWithIn<int> | ||
{ | ||
public void Method(in RuntimeMethodHandle arg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this syntax public void Method(in RuntimeMethodHandle arg) { }
is a bit more common.
@wzchua to skip the test on Mono, your can add this to your test method: This requires a new issue with a "runtime-mono" label. |
Since the 5.0 release has no more preview releases, and this is not a risk-free issue, we should consider committing this after we branch for 6.0 which is occurring August 17th. After it is in master, it is possible to merge this into the 5.0 branch (through the "ask mode" policy) or a future servicing branch but only when we are confident that it is not breaking and it meets the bar (by unblocking important scenarios). |
mono has a per domain scope for methodhandles Updated code as per review removed while loop for explicit instance check
My test was wrong and I have fixed it |
public void EmitMethodInfo() | ||
{ | ||
var methodType = typeof(IWithIn<int>); | ||
var method = methodType.GetMethod("Method"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: We use var
only when the type is obvious from the right side.
https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/coding-style.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for .NET 6
Test failures appear unrelated: one timeout and one OSX failure in |
@wzchua, I'm glad to see this long-standing issue finally resolved. Thanks for working on it! |
Signature generation now includes CustomModifiers
MethodBuilder and ConstructorBuilder passes their SignatureHelper for
generation via GetMethodSignature()
Based on dotnet/coreclr#17881
Fixes #25958