-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[mono] UnsafeAccessor to a virtual method on a base class through a derived type asserts #89212
Comments
Actually this fails on NativeAOT as well (at runtime!):
CoreCLR works and the same code without var instance = new InheritanceDerived();
instance.BaseVirtual(); will also work (probably on all runtimes, although I didn't try that). @AaronRobinsonMSFT @MichalStrehovsky what do you think - should this work? |
Well method This is what I brough up in #86932 (comment) and was rejected. |
@vitek-karas If I update as following it works, right? [UnsafeAccessor(UnsafeAccessorKind.Method, Name = nameof(BaseVirtual))]
extern static string BaseVirtual(InheritanceBase target); If so, I don't see why one would declare this as |
Does this work with CoreCLR? |
Yes - it does work on CoreCLR. |
@AaronRobinsonMSFT I think this should be in 8.0. We need to either block this in CoreCLR, or fix in NativeAOT/Mono. |
Btw, I think the CoreCLR behavior is the correct one |
Personally I agree with Michal's comment in the other issue that this "should" work. That said I'd be fine if we said that we don't want this to work. But then all runtimes should behave consistently. |
What needs to happen then in NativeAOT? Based on some offline conversations with @fanyang-mono, I believe she is looking into enabling it on mono. |
We'd walk into the base type, like we do when resolving a MemberRef:
(I assume it matches what CoreCLR does in the |
Yep. I just used the |
I think the work in Mono is just to replace the assert that the target class is equal to the method's class by a check that the target class is assignable to the method's class. |
This has been resolved via #89217. |
This fails with
@lambdageek - could you please route this to the right area/person
The text was updated successfully, but these errors were encountered: