-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Trimming support #2813
Comments
Any feature-rich reflection-based serializer or library (like Newtonsoft.Json/Json.NET) is a struggle regarding trimming. As the documentation you linked to states:
However, all is not lost. If you want to keep using Newtonsoft.Json while keeping trimming enabled, you will have to exclude any of the types (or their assemblies) that your application can potentially (de)serialize through Newtwonsoft.Json from trimming: https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options (But probably it is a good idea to first think about whether migration to System.Text.Json is feasible for you, which would save you from this particular trimming problem.) |
I guess in order to eliminate this warning, we need to include
But I'm not sure if this will set any metadata for this to be distributed via the NuGet package |
An easy fix would be to add Right now Newtonsoft.JSON doesn't work when fully trimmed, and it seems in our specific case it's the only library in this state now. |
When trying to publish an application with
<PublishTrimmed>true</PublishTrimmed>
, this library produces the following:I guess it doesn't support net6.0/net7.0 trimming - https://aka.ms/dotnet-illink/libraries
The text was updated successfully, but these errors were encountered: