-
Notifications
You must be signed in to change notification settings - Fork 494
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
Provide trimming annotations for self-contained apps #1057
Comments
We may have to switch to the Google.Protobuf library which isn't reflection-based in order to (a) get this working properly, and (b) be able to run in an AOT environment such as what is being planned at the moment for .NET 7. 🤔 |
Unified messages are no longer a blocker for this, since they are fully generated without reflection. |
I did have fun problems previously with trimming and nested classes. That said, what does "fails to deserialise" look like? |
It's trying to call an empty constructor which does not exist, it probably would have worked if it trimmed away the entire field if no one uses it. |
trimming can be disabled via
...
ILLink.xml:
|
.NET 5 previewed the ability to trim unused code from applications and from the runtime, and .NET 6 now makes that generally available.
Relevant docs are here: https://docs.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained
Considering how many protobuf messages we ship that most apps won't use, this is quite valuable. DepotDownloader can trim about 4.5-5 MB away from SteamKit2.dll and a fully self-contained trimmed build of DD is about 15-20MB IIRC.
Related issues:
Some initial prototyping has already been done in this pull request:
The text was updated successfully, but these errors were encountered: