JsonSerializer.SerializeAsync to PipeWriter or Stream throws when using source generated JsonSerializerContext and JsonSourceGenerationMode.Serialization #44413
Labels
⌚ Not Triaged
Not triaged
When using the JSON source generator with
[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Seralization)]
, theJsonSerializer.SerializeAsync|Serialize
methods that acceptStream
andPipeWriter
throwInvalidOperationException
. This is not a regression from .NET 8.0 (when using aStream
).Stack trace:
Full repro app that multi-targets
net8.0
andnet9.0
and shows serialization succeeding when using other overloads ofSerialize
or using a generatedJsonSerializationContext
with default generation mode:Output:
The text was updated successfully, but these errors were encountered: