Closed
Description
Description
When writing (U)Int128 as property name, the writer were fed with an unsliced stackalloc buffer after formatting the number:
Reproduction Steps
Using this code with .NET 9.0, the converter should returns as type (U)Int128Converter
using System;
using System.Text.Json;
var dict = new Dictionary<UInt128, string>() {
[0] = "Zero",
};
Console.WriteLine(JsonSerializer.Serialize(dict));
Expected behavior
The expected written json should be
{"0":"Zero"}
Actual behavior
The json
{"0\uFFFD\uFFFD\u0000\u0014\uFFFD\uFFFD\u0000\uFFFD\uFFFD\u001B\u000B\bpD\f\uFFFDl4\u0003\uFFFDn4\u0003\u0000\u0000\u0000\u0000\uFFFDn4\u0003@\uFFFDO\u0006\uFFFDl4":"Zero"}
was returned, and the escaping can be different every time code is ran, which mean garbage data were written.
Regression?
No response
Known Workarounds
No work around for this.
Configuration
System.Text.Json 9.0.x
Other information
No response