-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReadFromJsonAsync with nullable value types enabled makes return type look strange #46431
Labels
Comments
Dotnet-GitSync-Bot
added
the
untriaged
New issue has not been triaged by the area owner
label
Dec 28, 2020
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Triage: consider as part of #1256. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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: