diff --git a/src/Components/Blazor/Validation/src/ValidateComplexTypeAttribute.cs b/src/Components/Blazor/Validation/src/ValidateComplexTypeAttribute.cs index 4769d84767ad..b236f8d6e18d 100644 --- a/src/Components/Blazor/Validation/src/ValidateComplexTypeAttribute.cs +++ b/src/Components/Blazor/Validation/src/ValidateComplexTypeAttribute.cs @@ -19,11 +19,10 @@ public sealed class ValidateComplexTypeAttribute : ValidationAttribute /// 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; } }