Runtime: Prevent the value out param of TryGetX methods of Utf8JsonReader and JsonDocument from containing an instantiated instance when we return false

Created on 23 Apr 2019  路  5Comments  路  Source: dotnet/runtime

e.g., in https://github.com/layomia/corefx/blob/3a41aebc08a55f6346ad56f711ce198a0bde54c3/src/System.Text.Json/src/System/Text/Json/Document/JsonDocument.cs#L482-L485, if the input segment is succesfully parsed, but segment.Length == bytesConsumed is false, we'll return false and out a DateTime instance.

This also occurs in other places in the namespace.

We want to emit default(T) when false is returned, and should not emit a semantic value.

area-System.Text.Json

Most helpful comment

Hah, yes thanks @layomia. That came straight from the Department of Recursion's Department of Recursion...

All 5 comments

@layomia @watfordgnf I guess this is already assigned? Or is it still up for grabs? Thanks!

I have dotnet/corefx#37119 which addresses this, but it hasn't been reviewed yet.

I have dotnet/corefx#37119 which addresses this, but it hasn't been reviewed yet.

I think you mean https://github.com/dotnet/corefx/pull/37838. I'll review it shortly.
Thanks @watfordgnf @WinCPP

Hah, yes thanks @layomia. That came straight from the Department of Recursion's Department of Recursion...

@watfordgnf, I can't assign the issue to you yet (your name doesn't show up in the list under assignees). @karelz, I have removed the up-for-grabs label. Hope that helps with queries.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bencz picture bencz  路  3Comments

yahorsi picture yahorsi  路  3Comments

jchannon picture jchannon  路  3Comments

jzabroski picture jzabroski  路  3Comments

matty-hall picture matty-hall  路  3Comments