Skip to content

Fix error message displayed when a property marked as DisallowNull is set to null - #3081

Open
whippet71 wants to merge 1 commit into
JamesNK:masterfrom
whippet71:disallownull-fix
Open

Fix error message displayed when a property marked as DisallowNull is set to null#3081
whippet71 wants to merge 1 commit into
JamesNK:masterfrom
whippet71:disallownull-fix

Conversation

@whippet71

Copy link
Copy Markdown

The docs state that if a property is not required but also cannot be a null value, then we can mark it with (Required = Required.DisallowNull). However if the property is set to null, the error message displayed is "Required property '{propName}' expects a non-null value", which is incorrect, as the property is not required.

The fix is to change the error message in JsonSerializerInternalReader.cs, and to update JsonSerializerTests.cs accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant