Incorrect CustomValidationAttribute remarks
Content: https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.customvalidationattribute.method?view=netcore-2.2 Content source: xml/System.ComponentModel.DataAnnotations/CustomValidationAttribute.xml
The remarks for the Method property of CustomValidationAttribute incorrectly state that the specified method must return a Boolean and takes a ValidationResult out param. In .Net Core 2.2 at least, it must return a ValidationResult.
Maybe the signature is different in different languages?
Additionally, it would be preferable to have the valid signatures listed as code snippets rather than described in text.
Thank you for your feedback @hrobertson.
@lajones, @divega, @ajcvickers can you help with this issue? Are there differences in behavior between .NET Framework and .NET Core for this API? Thanks.
Doesn't look like it: https://referencesource.microsoft.com/#System.ComponentModel.DataAnnotations/DataAnnotations/CustomValidationAttribute.cs,db5138ec9e85f648
Note that there are issues other than the wrong signature.
Copy-paste from #11769 that I opened and closed a bit too soon:
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).