-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Type of issue
Other (describe below)
Description
"it must return a Boolean value": this sentence (and others) is wrong, for .Net Framework (4.8.1 and maybe older versions) and all versions of .Net.
Actual:
This documentation says: method prototype should look like bool MyMethod(<type> value)
or bool MyMethod(<type> value, ValidationContext context, out ValidationResult result)
.
Expected:
Documentation says that method prototype should look like ValidationResult? MyMethod(<type> value)
or ValidationResult? MyMethod(<type> value, ValidationContext? context)
.
The return value can also be a class derived of ValidationResult
since .Net Core 3 or .Net 5 (this commit is dated to before .Net Core 3.0, but tagged with release/5.0).
It should also be noted that the ValidationContext
instance passed on to the method is always null
for .Net Framework because CustomValidationAttribute
does not override ValidationAttribute.RequiresValidationContext
(for .Net, this has been fixed by this commit in january 2016, so before the release of .Net Core 1.0).
The correct documentation can be found in the source code of CustomValidationAttribute: .Net/.Net Framework.
Page URL
Content source URL
Document Version Independent Id
ba1cc98b-e6b7-bf0a-9307-d450b7ff2a35
Platform Id
3ece839c-4d1d-102f-b15f-c7f88d39bc62