Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

How this repo makes Newtonsoft works on AOT? #147

Answered by applejag
gustavopsantos asked this question in Q&A
Discussion options

You must be logged in to vote

Excellent question!

On a higher level, I've filtered out the code that uses System.Reflection.Emit and other JIT-based code via a new build target. One key example of where this filtering is applied is at:

https://github.com/jilleJr/Newtonsoft.Json-for-Unity/blob/2a26db68c98003f28749203378a3863afa5e6885/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs#L1405-L1426

And:

https://github.com/jilleJr/Newtonsoft.Json-for-Unity/blob/2a26db68c98003f28749203378a3863afa5e6885/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs#L514-L531

The UNITY_LTS pragma flag has been sprinkled across the repo to filter out some features. Newtonsoft.Json is built in such a way that it supports a lo…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gustavopsantos
Comment options

Answer selected by gustavopsantos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants