Add functional custom JsonConverter tests for Int128/UInt128/Half#74254
Add functional custom JsonConverter tests for Int128/UInt128/Half#74254krwq merged 2 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsContributes to: #73500 Add tests to make sure user-written converter for new numeric types work correctly
|
| } | ||
| else | ||
| { | ||
| return Parse(Encoding.UTF8.GetString(reader.ValueSpan)); |
There was a problem hiding this comment.
In the interest of validating feasibility, can this converter be written in a way that avoids the intermediate string allocations?
There was a problem hiding this comment.
I'll need to convert to UTF-16 either way since (I think) none of these have UTF-8 overloads. I could possibly create char buffer on the stack with stackalloc but then ReadOnlySequence gets relatively complicated and I have to put some arbitrary numbers for guessed max size of the buffer. I think for simplicity better to keep it as is...
Contributes to: #73500
Add tests to make sure user-written converter for new numeric types work correctly