Skip to content

Fix serialization scrub/convert bugs and reduce per-value scrubbing allocations#1770

Merged
SimonCropp merged 5 commits into
mainfrom
Fix-serialization-scrub/convert-bugs-and-reduce-per-value-scrubbing-allocations
Jul 5, 2026
Merged

Fix serialization scrub/convert bugs and reduce per-value scrubbing allocations#1770
SimonCropp merged 5 commits into
mainfrom
Fix-serialization-scrub/convert-bugs-and-reduce-per-value-scrubbing-allocations

Conversation

@SimonCropp

Copy link
Copy Markdown
Member
  • Static ScrubMembers/ScrubMember/ScrubMembers(Type,names) now scrub instead of ignore (they delegated to Ignore*, silently removing the member rather than rendering it as {Scrubbed})
  • VerifyJsonWriter: only apply the remove/newline-prefix trick for a multiline string in property position; in array position write the value directly so the ',' delimiter between items is preserved
  • SerializationSettings copy constructor now copies OrderDictionaries, so DontSortDictionaries survives a per-test settings clone
  • GetMemberConverter keeps iterating on a name miss instead of returning null from the first assignable type
  • TupleConverter: iterate the flattened ITuple length so fully-named 8+ element tuples work, and reject nested named tuples with a clear message
  • NumericId scrubbing keys on the value's invariant string instead of Convert.ToInt64, avoiding OverflowException for ulong/decimal/double/NaN and no longer collapsing distinct fractional values
  • ApplyForPropertyValue fast-paths values that cannot change (no scrubbers, no '\r', shorter than the shortest replacement) to avoid the StringBuilder round-trip and directory-replacement scan; FindMatches bails when the builder is shorter than the shortest pair
  • Cache the ImmutableArray IsDefaultOrEmpty getter per type; use StringComparison.Ordinal in collection detection
  • Add tests for the above

…llocations

- Static ScrubMembers<T>/ScrubMember<T>/ScrubMembers(Type,names) now scrub
  instead of ignore (they delegated to Ignore*, silently removing the member
  rather than rendering it as {Scrubbed})
- VerifyJsonWriter: only apply the remove/newline-prefix trick for a multiline
  string in property position; in array position write the value directly so the
  ',' delimiter between items is preserved
- SerializationSettings copy constructor now copies OrderDictionaries, so
  DontSortDictionaries survives a per-test settings clone
- GetMemberConverter keeps iterating on a name miss instead of returning null
  from the first assignable type
- TupleConverter: iterate the flattened ITuple length so fully-named 8+ element
  tuples work, and reject nested named tuples with a clear message
- NumericId scrubbing keys on the value's invariant string instead of
  Convert.ToInt64, avoiding OverflowException for ulong/decimal/double/NaN and
  no longer collapsing distinct fractional values
- ApplyForPropertyValue fast-paths values that cannot change (no scrubbers, no
  '\r', shorter than the shortest replacement) to avoid the StringBuilder
  round-trip and directory-replacement scan; FindMatches bails when the builder
  is shorter than the shortest pair
- Cache the ImmutableArray IsDefaultOrEmpty getter per type; use
  StringComparison.Ordinal in collection detection
- Add tests for the above
@SimonCropp SimonCropp added this to the 31.21.0 milestone Jul 5, 2026
actions-user and others added 4 commits July 5, 2026 11:37
@SimonCropp SimonCropp merged commit 47a50c0 into main Jul 5, 2026
2 of 3 checks passed
@SimonCropp SimonCropp deleted the Fix-serialization-scrub/convert-bugs-and-reduce-per-value-scrubbing-allocations branch July 5, 2026 12:32
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.

2 participants