Migrate to System.Text.Json#60
Conversation
|
Needs testing, but otherwise feature complete |
| DynamicJsonConverter.Write(writer, key.ValueType(), writtenValue, options); | ||
| } | ||
|
|
||
| writer.WriteEndObject(); |
There was a problem hiding this comment.
I don't understand what you're referring to
There was a problem hiding this comment.
Oh if you're referring to ending the object twice, it's because:
{
"version": "...",
"values": {
//...
} // first
} // second|
@XDelta is there anything left blocking this PR? |
|
Pretty much just testing for breakage and what gets changed from older configs |
|
I'll double check but I think I've been daily driving this custom build for some time now. Would need broader testing with other mods probably to be extra sure. Though this would break mods that implement custom serializers for Newtonsoft.Json. |
|
In some initial testing, there are a few that seem to not be saving or being able to use their config. CherryTypes, ModSettings, SpecialItemsLib showed some issues in my local copy. |
|
CherryTypes is using a custom Newtonsoft.Json serializer and needs to be updated, I would expect issues to arise there. |
|
While updating CherryTyes, I found a potential issue. By default, |
|
What errors were you getting with ModSettings? (are we using the same mod?)
|
|
Im not at home but I think it was trying to do System.Type, and one other was some ValueTuple or Dict. Mainly trying to check as many as I can to address breakages where possible so that affected mods can have issues/prs created. |
|
Here's a table showing the breakages that may arise from the migration: |
Resolves #22
Notable changes:
Coder<T>type anymoreConfigurationConverter for reading and writing config filesConfigurationConverter uses a thread local "context" to know what mod's config it's reading or writingThis was needed becauseSystem.Text.Jsonis a streaming API, which means that we can't just deserialize everything into a JObject and then parse it further once the version is read. With the streaming API, the config converter first reads the version field (which must come first, which it does) and then decides how to read the remaining JSON.Advantage is that parsing configs should be much faster (though this has never been a problem for me)The general structure is there, but further polishing is needed.