Newtonsoft.Json icon indicating copy to clipboard operation
Newtonsoft.Json copied to clipboard

Needs nativeaot compatibility

Open NCLnclNCL opened this issue 9 months ago • 1 comments

Although system.text.json is compatible with json, it seems that very few projects use it because it is unfamiliar and only available for dotnet core a lot of projects use this but because this is not trimmed it has a lot more size compared to the newer library i wish someone can make it compatible with native aot, or show me how to reduce the compile size with this library

NCLnclNCL avatar Sep 08 '23 18:09 NCLnclNCL

I believe that (with apologies if my knowledge of newtonsoft.json is not up to date: There are aspects of this library that are compatible with nativeaot (e.g. using JsonObject constructors etc. to serialize and deserialize). There are also aspects that are not compatible (e.g. taking a dotnet class and using reflection to serialize and deserialize it).

This library then would need to be annotated for trimming. E.g. DynamicallyAccessedCode annotations on Serialize<'T>. Then consumers of the library will not see warnings unless they use the problematic code.

charlesroddie avatar Sep 13 '23 11:09 charlesroddie