We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Imagine this program:
class Cat { public string Name { get; set; } = default!; public string? Foo { get; set; } public override string ToString() { return Name ?? "ERROR"; } } class Program { static void Main(string[] args) { var cat = JsonSerializer.Deserialize<Cat>("{}"); Console.WriteLine(cat); } }
I expected that the JsonSerializer would throw if the non-nullable values are not present in the json string.
<TargetFramework>netcoreapp3.1</TargetFramework>
no (?)
We have not found an easy workaround to conveniently enforce null safety for a huge amount of classes.
The text was updated successfully, but these errors were encountered:
Looks like a duplicate of #1256
Sorry, something went wrong.
Sorry, you are right!
No branches or pull requests
Description
Imagine this program:
I expected that the JsonSerializer would throw if the non-nullable values are not present in the json string.
Configuration
<TargetFramework>netcoreapp3.1</TargetFramework>
Regression?
no (?)
Other information
We have not found an easy workaround to conveniently enforce null safety for a huge amount of classes.
The text was updated successfully, but these errors were encountered: