Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Npgsql/Internal/TypeHandlers/SystemTextJsonHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected internal override int ValidateAndGetLengthCustom<TAny>([DisallowNull]
parameter.ConvertedValue = data;
return lengthCache.Set(data.Length + _headerLen);
}

if (typeof(TAny) == typeof(JsonObject) || typeof(TAny) == typeof(JsonArray))
{
lengthCache ??= new NpgsqlLengthCache(1);
Expand Down Expand Up @@ -202,8 +202,8 @@ byte[] SerializeJsonObject(JsonNode jsonObject)
// We need to implement one-pass writing to serialize directly to the buffer (or just switch to pipelines).
using var stream = new MemoryStream();
using var writer = new Utf8JsonWriter(stream);
jsonObject.WriteTo(writer);
jsonObject.WriteTo(writer, _serializerOptions);
writer.Flush();
return stream.ToArray();
}
}
}