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
It is deserialized fine with Newtonsoft, but not with System.Text.
The reason is that constructor parameter type is int? while the property has type of int.
Newtonsoft doesn't validate it, giving an option to do anything in the constructor.
There are possible workarounds but they are not as simple as the original code:
Make property private and add a public non nullable:
Description
Given string:
It is deserialized fine with Newtonsoft, but not with System.Text.
The reason is that constructor parameter type is
int?
while the property has type ofint
.Newtonsoft doesn't validate it, giving an option to do anything in the constructor.
There are possible workarounds but they are not as simple as the original code:
Make property private and add a public non nullable:
Annotate nullable as non nullable, however it requires explicit call to
Value
.:Configuration
Regression?
Not a regression.
Other information
The text was updated successfully, but these errors were encountered: