-
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
ILLink shoud keep all metadata for rooted members #81979
Comments
Tagging subscribers to this area: @dotnet/area-system-reflection-metadata Issue DetailsBackground and motivationIn relation to 166ceb8, #73241 and #74141, one possible avenue to allow for System.Text.Json to work with the IL Linker is to allow for metadata to be kept. The linker is currently trimming all metadata, regardless of the presence of the type in the trimmer root configuration file. Exposing the Linker task's
would allow an easier migration path without resorting to generated serializers. API Proposal<TrimmerKeepMetadata>all</TrimmerKeepMetadata> API Usage<TrimmerKeepMetadata>all</TrimmerKeepMetadata> or <TrimmerKeepMetadata>parametername</TrimmerKeepMetadata> Alternative DesignsNo response RisksI can't think of any, since not specifying the keep metadata is introducing more issues than it solves (even if it reduces the size impact of the linker)
|
The migration path is exactly the one of the JSON source generator. Why can't you use it, and why don't trimmer root descriptors solve your problem? |
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsBackground and motivationIn relation to 166ceb8, #73241 and #74141, one possible avenue to allow for System.Text.Json to work with the IL Linker is to allow for metadata to be kept. The linker is currently trimming all metadata, regardless of the presence of the type in the trimmer root configuration file. Exposing the Linker task's
would allow an easier migration path without resorting to generated serializers. API Proposal<TrimmerKeepMetadata>all</TrimmerKeepMetadata> API Usage<TrimmerKeepMetadata>all</TrimmerKeepMetadata> or <TrimmerKeepMetadata>parametername</TrimmerKeepMetadata> Alternative DesignsNo response RisksI can't think of any, since not specifying the keep metadata is introducing more issues than it solves (even if it reduces the size impact of the linker)
|
Backward source compatibility with previous versions of .NET which do not have support for generators is one. Migration to later versions of .NET without changing code is about removing friction for developers.
Descriptors only impact types visibility, not metadata like parameters. This ILLink option is exactly about the scenario mentioned above. The use case raising this proposal is for mobile apps using iOS/Android/Catalyst which require the use of the linker to not be large size regression from AOT-enabled Xamarin-based builds. |
Can you expand on this? Type that is specified as a root should not have the parameter names trimmed on any of its method. If it does, that's a trimming bug. The only methods that can have parameter names trimmed are those that are not visible targets of reflection. Methods that are not visible targets of reflection are fair game to optimize. Trimming can: inline such method and delete it, rename such method, strip parameter names, etc. Removing parameter names is only one of the optimizations trimmings does (or will do in the future). |
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas Issue DetailsBackground and motivationIn relation to 166ceb8, #73241 and #74141, one possible avenue to allow for System.Text.Json to work with the IL Linker is to allow for metadata to be kept. The linker is currently trimming all metadata, regardless of the presence of the type in the trimmer root configuration file. Exposing the Linker task's
would allow an easier migration path without resorting to generated serializers. API Proposal<TrimmerKeepMetadata>all</TrimmerKeepMetadata> API Usage<TrimmerKeepMetadata>all</TrimmerKeepMetadata> or <TrimmerKeepMetadata>parametername</TrimmerKeepMetadata> Alternative DesignsNo response RisksI can't think of any, since not specifying the keep metadata is introducing more issues than it solves (even if it reduces the size impact of the linker)
|
This issue has been marked |
The scenario is as follows. A The Linker is running during the build of an |
@sbomer Is this the expected behavior? Do we trim parameter names even for assemblies that are preserved using |
I've confirmed the behavior - using a root descriptor doesn't prevent parameter names from being stripped. I agree with @MichalStrehovsky's comment in the sense that I think we should treat members rooted by descriptor as reflection-visible (we currently don't). |
I have the same problem |
KeepMetadata
parameter
Background and motivation
In relation to 166ceb8, #73241 and #74141, one possible avenue to allow for System.Text.Json to work with the IL Linker is to allow for metadata to be kept. The linker is currently trimming all metadata, regardless of the presence of the type in the trimmer root configuration file.
Exposing the Linker task's
KeepMetadata
:runtime/src/tools/illink/src/ILLink.Tasks/LinkTask.cs
Line 226 in 4570167
would allow an easier migration path without resorting to generated serializers.
API Proposal
API Usage
or
Alternative Designs
No response
Risks
I can't think of any, since not specifying the keep metadata is introducing more issues than it solves (even if it reduces the size impact of the linker)
The text was updated successfully, but these errors were encountered: