-
Notifications
You must be signed in to change notification settings - Fork 127
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
Don't remove MethodImpl if overridden method is not in a link assembly #2771
Conversation
Before removing overrides, we should check if the overridden method is in an ignore scope.
Definitely think we need a test here. @sbomer any idea on what might be happening in the runtime repo that isn't the same in our testing system? |
We should be able to repro it in the test infra, sounds like @jtschuster was able to get a repro. |
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.
LGTM, thanks!
One nit: when you check it in, I'd update the commit title to not mention |
Ah, so the thing I was missing here was
which turns the S.P.C reference to "skip" |
About how long does it normally take this to flow to |
Looks like dotnet/runtime#68650 has it and I just need to wait on that to merge. |
Typically less then a day... if everything is green - which it hasn't been (as we improve the analyzer we find either issues in the analyzer or in the setup in runtime repo) |
… assembly (dotnet#2771)" This reverts commit 4461068.
* Revert "Trim static interfaces (#2741)" This reverts commit a073a68. * Revert "Don't remove MethodImpl if overridden method is not in a link assembly (#2771)" This reverts commit 4461068. * Revert "Fix NullReferenceException when sweeping unused static interface (#2783)" This reverts commit 00e9a15.
dotnet/linker#2771) Before removing overrides, we should check if the overridden method is in an ignore scope. Commit migrated from dotnet/linker@4461068
* Revert "Trim static interfaces (dotnet/linker#2741)" This reverts commit dotnet/linker@a073a68. * Revert "Don't remove MethodImpl if overridden method is not in a link assembly (dotnet/linker#2771)" This reverts commit dotnet/linker@4461068. * Revert "Fix NullReferenceException when sweeping unused static interface (dotnet/linker#2783)" This reverts commit dotnet/linker@00e9a15. Commit migrated from dotnet/linker@eb6144b
Before removing overrides, we should check if the overridden method is
in an ignore scope.
In the linker we consider types and methods in a
skip
assembly as "removed", so when the linker would check if an overridden method is removed, it would see that it is considered removed, even though it should be considered kept. The workaround is to use the IgnoreScope helper to determine if the interface method is in alink
assembly and removed, and only remove the MethodImpl if both are true.Now, whether
ShouldRemove
should return true or false for things in a skip assembly, I'm not sure. It depends on whether it does / should mean "Actively removed from the assembly" or "not in the final output".This PR fixes the issues found in dotnet/runtime#68612.