Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For System.Text.Json it is imperative to use static serializer options, see https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/configure-options?pivots=dotnet-6-0 . Aside from the performance penalty, the memory and GC pressure is enormous for a high volume client.
I believe Newtonsoft uses a static cache internally so it is not affected by a non-static settings instance, but there is no harm in making the Newtonsoft settings static as well.
This is a breaking change to users with partials that configure these settings. It would be reasonable to wrap the Newtonsoft case in a new UI settings flag, but it is catastrophic for STJ without it and should not be an option.