-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Port CoreRT fix to System.Reflection.MetadataLoadContext #28046
Comments
Marking as |
I have open corresponding PR for this issue with fix. #37204 |
@MichalStrehovsky do you recall the scenario? I was unable to find a repro with that code path. I assume some combination of a base class and derived class with open and closed generic parameters. |
Moving to future until we can get a repro. The existing test cases in
Adding variants of this was unable to repro. |
If I'm reading this code correctly, this code path is only reachable from Please double check and if so, we can probably close and open an issue to deleted dead code instead. I assume |
See the linked PR -- I can hit that branch, just not trigger the exception you reported. I'll create another PR to remove that dead code. Thanks |
Looking at the linked PR, if you say we're hitting the branch with t1 = some generic type and t2 = Also,could it be that the equivalent of I don't recall the details anymore. It was a customer reported issue and all context is lost to GDPR compliance. |
The //
// This helper compares the types of the corresponding parameters of two methods to see if one method is signature equivalent to the other.
// This is needed when comparing the signatures of two generic methods as Type.Equals() is not up to that job.
//
private static bool GenericMethodAwareAreParameterTypesEqual(Type t1, Type t2)
{
// Fast-path - if Reflection has already deemed them equivalent, we can trust its result.
if (t1.Equals(t2))
return true;
// If we got here, Reflection determined the types not equivalent. Most of the time, that's the result we want.
// There is however, one wrinkle. If the type is or embeds a generic method parameter type, Reflection will always report them
// non-equivalent, since generic parameter type comparison always compares both the position and the declaring method. For our purposes, though,
// we only want to consider the position. So I was unable to construct a case that hits the line in question. FWIW the call stack when that line in question is hit:
|
It's possible this was only reachable from GetImplicitlyOverriddenBaseClassMember (I vaguely remember we hit this while trying to get inherited custom attributes on CoreRT). Since MetadataLoadContext decided it doesn't want to support APIs that retrieve inherited attributes and you're deleting the vestigial support for it, it's possible the bug is unreachable (still there, for someone to hit in the future, but not reachable right now). I don't have enough context on MetadataLoadContext to really sign off. I hope there's a co-owner of the component who can do that. Thanks for looking into it. I only filed this bug because I got it as a feedback review for the CoreRT reflection stack fix. I don't intend to ramp up on MetadataLoadContext. |
Closing this. Please re-open if we have a repro. |
Port this to MetadataLoadContext and add test coverage:
dotnet/corert@93364da
The text was updated successfully, but these errors were encountered: