C
C#2y ago
devhl

❔ 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
mtreit
mtreit2y ago
Where does it say that null will cause an exception?
devhl
devhlOP2y ago
devhl
devhlOP2y ago
The last word.
mtreit
mtreit2y ago
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
devhl
devhlOP2y ago
oh... oh there are try versions of these commands, nice
Accord
Accord2y ago
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.
Want results from more Discord servers?
Add your server