❔ Utf8JsonReader.GetString exceptions
This document seems to contradict itself. The returns section says if the token is null then you get null, but the exceptions say null will cause an exception. Am I understanding this right and it is wrong documentation?
https://learn.microsoft.com/en-us/dotnet/api/system.text.json.utf8jsonreader.getstring?view=net-7.0#returns
Utf8JsonReader.GetString Method (System.Text.Json)
Reads the next JSON token value from the source unescaped and transcodes it as a string.
6 Replies
Where does it say that null will cause an exception?
The last word.
That says the exact opposite
It's saying it will throw if the value is NOT one of:
1. A string.
2. A PropertyName
3. Null
oh...
oh there are try versions of these commands, nice
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.