diff --git a/src/Components/Blazor/Validation/src/ValidateComplexTypeAttribute.cs b/src/Components/Blazor/Validation/src/ValidateComplexTypeAttribute.cs index 4769d84767ad07a1df0f82c7029ee1dd812439f9..b236f8d6e18de19a56de363583b468689bf9ddff 100644 --- a/src/Components/Blazor/Validation/src/ValidateComplexTypeAttribute.cs +++ b/src/Components/Blazor/Validation/src/ValidateComplexTypeAttribute.cs @@ -19,11 +19,10 @@ namespace System.ComponentModel.DataAnnotations /// <inheritdoc /> protected override ValidationResult IsValid(object value, ValidationContext validationContext) { - if (!ObjectGraphDataAnnotationsValidator.TryValidateRecursive(value, validationContext)) - { - throw new InvalidOperationException($"{nameof(ValidateComplexTypeAttribute)} can only used with {nameof(ObjectGraphDataAnnotationsValidator)}."); - } + ObjectGraphDataAnnotationsValidator.TryValidateRecursive(value, validationContext); + // Validation of the properties on the complex type are responsible for adding their own messages. + // Therefore, we can always return success from here. return ValidationResult.Success; } }