-
Notifications
You must be signed in to change notification settings - Fork 5k
Add functional custom JsonConverter tests for Int128/UInt128/Half #74254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Contributes to: #73500
Add tests to make sure user-written converter for new numeric types work correctly