Uh oh!
There was an error while loading. Please reload this page.
Annotate System.Text.Json for nullable - #528
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ahsonkhan
left a comment
There was a problem hiding this comment.
48/125 files reviewed (JsonDocument, JsonElement, JsonNode, and related types).
Here's some feedback so far.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…ion/JsonSerializer.Read.Stream.cs Remove not needed attribute
buyaa-n
commented
Dec 31, 2019
Failed CI legs doesn't look like caused from this PR changes, gonna merge this |
danmoseley
commented
Jan 1, 2020
Yay! |
Awesome! Thanks for your patience and effort in getting this merged, @buyaa-n. I appreciate you taking your time with it and getting the details right. Nullability annotations of a complex library like JSON hopefully help explore and refine the guidelines. |
buyaa-n
commented
Jan 4, 2020
Thanks for your delicate review, learnt a lot. Have fun with nullability aware coding 😄 |
Uh oh!
There was an error while loading. Please reload this page.
ahsonkhan
commented
Feb 20, 2020
Moving comment from #114 (comment) (since that PR was closed). Highlighting the breaking change here (which became visible when enabling nullability analysis). Deserializing into a char is now more strict to match user expectations. The payload must contain a single-character string for deserialization to succeed: publicclassMyPoco{publiccharCharacter{get;set;}}publicstaticvoidTestDeserializeToChar(){// Before (3.1): NullReferenceException// After (5.0): JsonExceptionJsonSerializer.Deserialize<MyPoco>("{\"Character\": null}");// Before (3.1): IndexOutOfRangeException// After (5.0): JsonExceptionJsonSerializer.Deserialize<MyPoco>("{\"Character\": \"\"}");// Before (3.1): Set Character to the first character - 'a'// After (5.0): JsonExceptionJsonSerializer.Deserialize<MyPoco>("{\"Character\": \"abc\"}");}Passing in null for the publicstaticvoidTestSerializeNullType(){// Before (3.1): Returned a string with value "null"// After (5.0): ArgumentNullException: Value cannot be null. (Parameter 'type')JsonSerializer.Serialize(null,null);// Same with other Serialize{Async} overloads// Before (3.1): Returned a byte[] with value "null"// After (5.0): ArgumentNullException: Value cannot be null. (Parameter 'type')JsonSerializer.SerializeToUtf8Bytes(null,null);} |
Recreating PR as old one #114 no more accessible, gone with old private fork
CC @ahsonkhan@steveharter@stephentoub@safern