We have a class which inherits ValidationAttribute and functions as expected on save by validating the desired properties correctly and results either in ValidationResult.Success or a new error message.
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
return ValidateBlock(value, validationContext)
: new ValidationResult(ErrorMessage);
However when the user tries to publish the page with the error present, rather then seeing the custom error message again they receive "Key cannot be null. Parameter name: key".
We've stepped through our code and can see our custom error message being generated on publish. No errors are thrown so we're not sure where this other error message is coming from.
Has anyone else experienced this?