Skip to content

fix correctness bugs across core, JsonPath, Xml and FSharp#378

Merged
SimonCropp merged 2 commits into
mainfrom
fix-correctness-bugs-across-core,-JsonPath,-Xml-and-FSharp
Jul 6, 2026
Merged

fix correctness bugs across core, JsonPath, Xml and FSharp#378
SimonCropp merged 2 commits into
mainfrom
fix-correctness-bugs-across-core,-JsonPath,-Xml-and-FSharp

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

fix correctness bugs across core, JsonPath, Xml and FSharp

Add regression tests (src/ArgonTests/BugFixes/, NullTokenTests.fs) and fix:

core writer/reader

  • JsonConvert.ToString(TimeSpan) escaped the whole stack buffer, embedding NULs
  • JsonWriter.WriteValue(StringBuilder) wrote each chunk as a separate JSON string
  • JsonTextWriter.WriteValue(char) ignored QuoteValue/QuoteChar
  • JsonTextReader.Close() double-returned charBuffer to ArrayPool on a second call
  • JsonReader.SetUndefinedToken set Null instead of Undefined

serializer

  • JsonConverter.ReadJson returned null on container tokens without consuming them
  • OrderByKey packed the comparer into the sort key, making ordering culture-sensitive
  • JsonSerializerProxy did not forward ResolveContract or Converters to converters
  • CreateProperties used unstable List.Sort, scrambling order for >16 props with Order
  • removed duplicate EncodingConverter registration

utilities

  • GetDefaultValue(char) returned boxed int 0 so DefaultValueHandling.Ignore missed chars
  • BoxedPrimitives.Get(decimal) dropped the sign of negative zero
  • ISO parser accepted out-of-range zone offsets, throwing from the DateTimeOffset ctor

linq

  • CompareBigInteger inverted comparisons against negative fractions
  • GetHashCode/GetDeepHashCode were inconsistent with Equals across numeric types
  • TryAddInternal advanced the index when a child insert was skipped
  • implemented JObject IDictionary.Values (was NotImplementedException)

jsonpath

  • FieldMultipleFilter threw ErrorWhenNoMatch even when the property existed
  • numeric filter literals were not terminated by && or ||
  • $[-1] crashed instead of returning null

fsharp

  • FSharpList/FSharpMap converters crashed on a JSON null

xml

  • single-element nested arrays lost json:Array for prefixed/encoded names
  • multiple sibling comments serialized to "#comment": [], dropping the text
  • CreateXmlDocumentType discarded the DTD internal subset
  • #cdata-section/#text with a null value crashed for XDocument

fix correctness bugs across core, JsonPath, Xml and FSharp

Add regression tests (src/ArgonTests/BugFixes/, NullTokenTests.fs) and fix:

core writer/reader
- JsonConvert.ToString(TimeSpan) escaped the whole stack buffer, embedding NULs
- JsonWriter.WriteValue(StringBuilder) wrote each chunk as a separate JSON string
- JsonTextWriter.WriteValue(char) ignored QuoteValue/QuoteChar
- JsonTextReader.Close() double-returned charBuffer to ArrayPool on a second call
- JsonReader.SetUndefinedToken set Null instead of Undefined

serializer
- JsonConverter<T>.ReadJson returned null on container tokens without consuming them
- OrderByKey packed the comparer into the sort key, making ordering culture-sensitive
- JsonSerializerProxy did not forward ResolveContract or Converters to converters
- CreateProperties used unstable List.Sort, scrambling order for >16 props with Order
- removed duplicate EncodingConverter registration

utilities
- GetDefaultValue(char) returned boxed int 0 so DefaultValueHandling.Ignore missed chars
- BoxedPrimitives.Get(decimal) dropped the sign of negative zero
- ISO parser accepted out-of-range zone offsets, throwing from the DateTimeOffset ctor

linq
- CompareBigInteger inverted comparisons against negative fractions
- GetHashCode/GetDeepHashCode were inconsistent with Equals across numeric types
- TryAddInternal advanced the index when a child insert was skipped
- implemented JObject IDictionary.Values (was NotImplementedException)

jsonpath
- FieldMultipleFilter threw ErrorWhenNoMatch even when the property existed
- numeric filter literals were not terminated by && or ||
- $[-1] crashed instead of returning null

fsharp
- FSharpList/FSharpMap converters crashed on a JSON null

xml
- single-element nested arrays lost json:Array for prefixed/encoded names
- multiple sibling comments serialized to "#comment": [], dropping the text
- CreateXmlDocumentType discarded the DTD internal subset
- #cdata-section/#text with a null value crashed for XDocument
@SimonCropp SimonCropp added this to the 0.35.0 milestone Jul 6, 2026
@SimonCropp
SimonCropp merged commit 5c05e50 into main Jul 6, 2026
2 of 4 checks passed
@SimonCropp
SimonCropp deleted the fix-correctness-bugs-across-core,-JsonPath,-Xml-and-FSharp branch July 6, 2026 10:07
This was referenced Jul 6, 2026
This was referenced Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant