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

Missing cases in base/override method comparisons #5974

Open
sbomer opened this issue May 28, 2021 · 0 comments
Open

Missing cases in base/override method comparisons #5974

sbomer opened this issue May 28, 2021 · 0 comments
Assignees
Labels
Area: Linker Issues when linking assemblies.

Comments

@sbomer
Copy link
Member

sbomer commented May 28, 2021

I'm filing this issue to track concerns that came up in #5748 (comment). See that discussion for more context. The basic issue is that some base/override method comparisons don't account for the .override directive or variance of parameters.

PreserveRegistrations calls the helper TryGetBaseOrInterfaceRegisterMember to look for matching base methods:

https://github.com/xamarin/xamarin-android/blob/da536fcf1b663fd71adee40c06466547a04cc6ed/src/Microsoft.Android.Sdk.ILLink/PreserveRegistrations.cs#L87

It is also called from MonoDroidMarkStep, but I haven't looked into this usage.

There are a few potential issues along the lines that @jonpryor mentioned in #5748 (comment), but I don't have the full context to understand how concerning these are:

Compare this with FixAbstractMethodsStep:
https://github.com/xamarin/xamarin-android/blob/da536fcf1b663fd71adee40c06466547a04cc6ed/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixAbstractMethodsStep.cs#L228-L232
which does check for overrides
https://github.com/xamarin/xamarin-android/blob/da536fcf1b663fd71adee40c06466547a04cc6ed/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixAbstractMethodsStep.cs#L172-L175

https://github.com/xamarin/xamarin-android/blob/da536fcf1b663fd71adee40c06466547a04cc6ed/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixAbstractMethodsStep.cs#L160-L169

though I don't think it does anything to handle variance.

Long-term I think the ideal approach would be to build these kinds of comparisons into the linker and make the APIs available to custom steps. There may be more cases that need to be considered, such as default interface methods, and static virtual interface methods.

@sbomer sbomer added the needs-triage Issues that need to be assigned. label May 28, 2021
@jpobst jpobst added Area: Linker Issues when linking assemblies. and removed needs-triage Issues that need to be assigned. labels May 28, 2021
@jpobst jpobst assigned jonpryor and unassigned jpobst May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Linker Issues when linking assemblies.
Projects
None yet
Development

No branches or pull requests

3 participants