Closed sergey-kolodiy closed 8 years ago
Thanks for doing this, but this repo is read-only. Please see this blog post with more details around the rationale for that.
For bugs in System.ComponentModel.DataAnnotations.ValidationContext
, please file an issue in the http://github.com/dotnet/CoreFX repository.
I am using
CustomValidationAttribute
to add my own validation logic for ASP.NET Web API models. It works fine in most cases, except when I send an empty request body. In that case, I get the following exception:As you can see, the problem is that
ValidationContext
throws anArgumentNullException
in the constructor ifinstance
is null.I am wondering, is it correct behavior or not? Posting a request with an empty body can generate an exception in my server code. In turn, server returns
500
status code instead of400
.