-
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
Allow trimming FeatureGuard and FeatureSwitchDefinition attributes #100263
Conversation
Under AggressiveAttributeTrimming setting.
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr, @marek-safar |
Can we add a test? Since it seems to have broken a user (android). |
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
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.
Do we have trimmer cases in illink.sln that use AggressiveAttributeTrimming? I would have expected this to be caught by the ILVerify validation in the linker tests if we do.
AggressiveAttributeTrimming is a runtime-defined feature setting, not something built-in to ILLink. ILLink does have tests for attribute removal based on feature settings in general. |
I think the idea is to add a simple executable test (just like we do for other parts of libraries with regard to trimming) which would turn on aggressive attribute trimming and validate that the attributes are in fact removed. |
Right - I've added such a test. I think @jtschuster was asking specifically why this wasn't tested in the illink tests. |
The failure is known, and the job that looks like it's still running seems to be a timeout, also hit in other PRs. I created a known issue to track this: #100424. |
Under AggressiveAttributeTrimming setting.
Fixes #100256. AggressiveAttributeTrimming was attempting to remove RequiresDynamicCode attributes, but the type was still referenced by FeatureGuardAttribute:
runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.NonNativeAot.cs
Lines 19 to 20 in dc553fe
Adding FeatureGuardAttribute to the set of attributes that get removed with AggressiveAttributeTrimming fixes this. Also adding FeatureSwitchDefinitionAttribute because that one can be removed as well.