IL Trim attributes with a feature flag in all assemblies#126094
Draft
pavelsavara wants to merge 2 commits intodotnet:mainfrom
Draft
IL Trim attributes with a feature flag in all assemblies#126094pavelsavara wants to merge 2 commits intodotnet:mainfrom
pavelsavara wants to merge 2 commits intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-reflection-metadata |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds ILLink link-attributes to remove MetadataUpdateHandlerAttribute instances (and enable trimming of their referenced handler types) when System.Reflection.Metadata.MetadataUpdater.IsSupported is disabled, and adds a trimming test to validate the behavior.
Changes:
- Add per-library
ILLink.LinkAttributes.xmlfiles to removeMetadataUpdateHandlerAttributeinstances when the feature switch isfalse. - Wire the new link-attributes files into the affected library projects via
ILLinkLinkAttributesXmls. - Add a new
System.Runtimetrimming test console app that disables the feature switch and verifies the attribute + handler types are absent.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Text.Json/src/System.Text.Json.csproj | Embeds ILLink link-attributes for conditional removal of MetadataUpdateHandlerAttribute instances. |
| src/libraries/System.Text.Json/src/ILLink/ILLink.LinkAttributes.xml | Removes MetadataUpdateHandlerAttribute instances when MetadataUpdater.IsSupported is disabled. |
| src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/System.Runtime.TrimmingTests.proj | Adds a new trimming test app and disables the MetadataUpdater.IsSupported feature switch for it. |
| src/libraries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/MetadataUpdateHandlerTrimmed.cs | New trimming test app validating attribute + handler types are trimmed under the disabled switch. |
| src/libraries/System.ComponentModel.TypeConverter/src/System.ComponentModel.TypeConverter.csproj | Embeds ILLink link-attributes for conditional removal of MetadataUpdateHandlerAttribute instances. |
| src/libraries/System.ComponentModel.TypeConverter/src/ILLink/ILLink.LinkAttributes.xml | Removes MetadataUpdateHandlerAttribute instances when MetadataUpdater.IsSupported is disabled. |
| src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/Microsoft.Extensions.DependencyInjection.Abstractions.csproj | Embeds ILLink link-attributes for conditional removal of MetadataUpdateHandlerAttribute instances. |
| src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ILLink/ILLink.LinkAttributes.xml | Removes MetadataUpdateHandlerAttribute instances when MetadataUpdater.IsSupported is disabled. |
...ries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/MetadataUpdateHandlerTrimmed.cs
Show resolved
Hide resolved
8bfadf3 to
8018fac
Compare
...ries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/MetadataUpdateHandlerTrimmed.cs
Show resolved
Hide resolved
...ries/System.Runtime/tests/System.Runtime.Tests/TrimmingTests/MetadataUpdateHandlerTrimmed.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/ILLink/ILLink.LinkAttributes.Shared.xml
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MetadataUpdateHandlerAttributeDebuggableAttribute
DebuggerBrowsableAttribute
DebuggerDisplayAttribute
DebuggerHiddenAttribute
DebuggerNonUserCodeAttribute
DebuggerStepperBoundaryAttribute
DebuggerStepThroughAttribute
DebuggerTypeProxyAttribute
DebuggerVisualizerAttribute
Tracing.EventAttribute
Tracing.EventDataAttribute
Tracing.EventFieldAttribute
Tracing.EventIgnoreAttribute
Tracing.EventSourceAttribute
Tracing.NonEventAttribute
MetadataUpdateHandlerAttribute
ClassInterfaceAttribute
ComDefaultInterfaceAttribute
ComEventInterfaceAttribute
ComSourceInterfacesAttribute
ComVisibleAttribute
DispIdAttribute
InterfaceTypeAttribute
ProgIdAttribute
TypeMapAssemblyTargetAttribute
TypeMapAssociationAttribute
TypeMapAttribute