Try our conversational search powered by Generative AI!

ValidationAttribute - Key cannot be null. Parameter name: key

Vote:
 

Hi

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)
				? ValidationResult.Success
				: 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?

Cheers

Jonathan.

#91255
Oct 01, 2014 7:42
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.