-
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
Epic: .NET libraries are annotated to support trimming and we provide trimming guidance for library authors #43543
Comments
Tagging: @agocke, @eerhardt, @vitek-karas , @sbomer |
We should consolidate with dotnet/aspnetcore#27384, that should probably become a child? |
To support library authors we will need to have a way to run analyzers to produce the right warnings, both in the IDE (Roslyn analyzers) as well as all up (possibly even the linker in some form).
Basically dotnet/sdk#14562 but for libraries. This applies to other scenarios like single-file, AOT and so on as well. |
@samsp-msft I updated the description to reflect what made 6.0 and what didn't. I propose that we close this and create a new epic for .NET 7 that captures the items that are carrying over, so that we can reference what was completed in 6.0 and what was cut. |
Closing as we are done for 6.0. |
The trimming story is a journey where we are improving the capabilities release to release. With .NET 5, we have added the linker capability for trimming and started the annotation effort for the framework.
For an application to be correctly fully trimmable, we need to know all the places where dynamic code patterns such as reflection and reflection emit are used. Along with that we will provide annotations for the linker so that it knows how to find the required types so that they are not trimmed, provide a source generator equivalent, or if the functionality is inherently supportable in conjunction with trimming then to provide an error to the app developer.
Goals
Annotating the framework
This is a recursive initiative as each layer of the onion will potentially increase the surface area that can be trimmable and uncover additional APIs that need to be annotated. Decisions on which APIs should be focused on should be driven by usage stats (if we have them).
Annotating Libraries
Most customer applications make use of libraries from third parties, commonly via NuGet, those also need to be annotated for trimming. We need to provide tooling to assist the developers in determining which of their APIs need to be annotated, and how to annotate them. The current library analysis uses hidden command line switches and needed to be augmented with custom tools created by the engineer currently working on annotations. The experience needs to be exposed in Visual Studio for both library consumers and library authors, with the ability to drill into the specifics of which API dependencies are causing issues.
We will need an outreach program for library authors, and probably have a way to filter out packages that are not trimmable from NuGet searches.
AOT annotations
All the annotations for trimming also assist in native AOT scenarios, as that has the same problem with not being able to determine dependencies when reflection is used. There are some additional limitations of native AOT that needs similar annotations to the attributes used for trimming. This should be added early so that the annotation exercise can consider both scenarios.
User Stories
Issues
Marked with (see query)
Items not completed in .NET 6
The text was updated successfully, but these errors were encountered: