We're encountering System.Text.Json's 125MB serialization limit when working with FHIR resources that contain large base64-encoded document content.
Problem
The Firely SDK uses System.Text.Json for serialization and converts base64 byte arrays to strings. System.Text.Json has a hard limit on string value length during serialization, which causes failures when document content is large.
Background
System.Text.Json removed the base64 length limit for byte arrays in this PR: dotnet/runtime#85334
However, since the Firely SDK converts base64 bytes to strings before serialization, this fix doesn't apply. The string length limit still triggers.
We've added context about this issue affecting production workloads in the original System.Text.Json issue: dotnet/runtime#39953
Request
Could the SDK be updated to leverage the byte array serialization path (which no longer has the limit) rather than converting to strings? Or alternatively, is there another approach that would avoid hitting this limit?
Environment
- Firely SDK version: 6.1.1
- .NET version: 8
We're encountering System.Text.Json's 125MB serialization limit when working with FHIR resources that contain large base64-encoded document content.
Problem
The Firely SDK uses System.Text.Json for serialization and converts base64 byte arrays to strings. System.Text.Json has a hard limit on string value length during serialization, which causes failures when document content is large.
Background
System.Text.Json removed the base64 length limit for byte arrays in this PR: dotnet/runtime#85334
However, since the Firely SDK converts base64 bytes to strings before serialization, this fix doesn't apply. The string length limit still triggers.
We've added context about this issue affecting production workloads in the original System.Text.Json issue: dotnet/runtime#39953
Request
Could the SDK be updated to leverage the byte array serialization path (which no longer has the limit) rather than converting to strings? Or alternatively, is there another approach that would avoid hitting this limit?
Environment