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 support for escaped characters in JsonString (for {Try}GetDateTime{Offset}). #31487

Closed
ahsonkhan opened this issue Nov 13, 2019 · 3 comments
Assignees
Milestone

Comments

@ahsonkhan
Copy link
Member

See dotnet/corefx#42574 (comment)

Escaped characters don't work in the current implementation of JsonString (and they should, similar to JsonElement.GetDateTime and Utf8JsonReader.GetDateTime).

string testStr = "\"\\u0031997-07-16T19:20:30.4555555+14:00\"";

using var doc = JsonDocument.Parse(testStr);
Assert.True(doc.RootElement.TryGetDateTime(out DateTime dateTimeVal));

var jsonString = new JsonString(testStr);

// This currently fails, returning false.
Assert.True(jsonString.TryGetDateTime(out dateTimeVal));

See https://github.com/dotnet/corefx/blob/dc6136f34c7d4ebbc493a7bb6cf1d15bc82250e6/src/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.TryGet.cs#L849-L852

https://github.com/dotnet/corefx/blob/dc6136f34c7d4ebbc493a7bb6cf1d15bc82250e6/src/System.Text.Json/src/System/Text/Json/Document/JsonDocument.cs#L665-L669

cc @khellang

@eugenesmlv
Copy link
Contributor

I'm working on this issue.

@eugenesmlv
Copy link
Contributor

@ahsonkhan should I open a pull request in runtime repo?

@ahsonkhan
Copy link
Member Author

@eugenesmlv, yes, please.

@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the 5.0 milestone Feb 1, 2020
@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants