Skip to content
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

Add functional custom JsonConverter tests for Int128/UInt128/Half #74254

Merged
merged 2 commits into from
Aug 22, 2022

Conversation

krwq
Copy link
Member

@krwq krwq commented Aug 19, 2022

Contributes to: #73500

Add tests to make sure user-written converter for new numeric types work correctly

@ghost
Copy link

ghost commented Aug 19, 2022

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Contributes to: #73500

Add tests to make sure user-written converter for new numeric types work correctly

Author: krwq
Assignees: krwq
Labels:

area-System.Text.Json

Milestone: -

}
else
{
return Parse(Encoding.UTF8.GetString(reader.ValueSpan));
Copy link
Member

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?

Copy link
Member Author

@krwq krwq Aug 19, 2022

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...

Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@krwq krwq merged commit 161deec into dotnet:main Aug 22, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 21, 2022
@eiriktsarpalis eiriktsarpalis added this to the 8.0.0 milestone Jan 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants