JamesNK / Newtonsoft.Json

Json.NET is a popular high-performance JSON framework for .NET
https://www.newtonsoft.com/json
MIT License
10.8k stars 3.26k forks source link

Is Json.NET Supporting .NET 7 AOT? #2732

Open AloisKraus opened 2 years ago

AloisKraus commented 2 years ago

Stephen Toub has mentioned in https://devblogs.microsoft.com/dotnet/performance_improvements_in_net_7/comment-page-3/#native-aot

that if you publish a .NET 7 application with AOT support no JIT compiler exists. Is Json.NET able to work around that like System.Text.Json which has since .NET 6.0 compile time source generator support? I would love to continue to use Json.NET because it I still want to target .NET 4.8.

JamesNK commented 2 years ago

Unlikely. It wasn’t designed for AOT and adding something like a generator would be a huge amount of work.

owl-guy commented 1 year ago

@JamesNK So what now? Will there be a compatible version or should I look for a different Json Package? I'm not able to publish my app on iOS unless I have it use the interpreter.

g0dpain commented 1 year ago

@JamesNK So what now? Will there be a compatible version or should I look for a different Json Package? I'm not able to publish my app on iOS unless I have it use the interpreter.

use System.Text.Json

NCLnclNCL commented 1 year ago

Không thể. Nó không được thiết kế cho AOT và việc thêm một thứ gì đó như máy phát điện sẽ là một khối lượng công việc khổng lồ.

why??

madelson commented 9 months ago

adding something like a generator would be a huge amount of work

Would just falling back to reflection in the AOT scenario be a more feasible step forward? My guess is that reflection is plenty fast enough for most users.

BMurri commented 6 months ago

@madelson

Would just falling back to reflection in the AOT scenario be a more feasible step forward? My guess is that reflection is plenty fast enough for most users.

AOT includes trimming, which strips away a lot of reflection metadata. Source generation is basically a requirement for the AOT scenario.