You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using ReadFromJsonAsync in a nullable value type enabled .Net 5 ASP project has som strange behaviours.
For example: the following code return a MyClass? nullable object: var problemDetails = await response.Content.ReadFromJsonAsync<MyClass>();
This code returns a int (not nullable) (what happens if it is not a a numeric value in the response): var result = await response.Content.ReadFromJsonAsync<int>();
But this code returns a nullable string: var result = await response.Content.ReadFromJsonAsync<string>();
Shouldn't it return a none nullable string and throw if it is null?
The text was updated successfully, but these errors were encountered:
Using ReadFromJsonAsync in a nullable value type enabled .Net 5 ASP project has som strange behaviours.
For example: the following code return a MyClass? nullable object:
var problemDetails = await response.Content.ReadFromJsonAsync<MyClass>();
This code returns a int (not nullable) (what happens if it is not a a numeric value in the response):
var result = await response.Content.ReadFromJsonAsync<int>();
But this code returns a nullable string:
var result = await response.Content.ReadFromJsonAsync<string>();
Shouldn't it return a none nullable string and throw if it is null?
The text was updated successfully, but these errors were encountered: