diff --git a/src/Mvc/Mvc.Core/src/Microsoft.AspNetCore.Mvc.Core.WarningSuppressions.xml b/src/Mvc/Mvc.Core/src/Microsoft.AspNetCore.Mvc.Core.WarningSuppressions.xml
index 91235bbf293d..c85b32f539f6 100644
--- a/src/Mvc/Mvc.Core/src/Microsoft.AspNetCore.Mvc.Core.WarningSuppressions.xml
+++ b/src/Mvc/Mvc.Core/src/Microsoft.AspNetCore.Mvc.Core.WarningSuppressions.xml
@@ -787,5 +787,11 @@
member
M:Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ComplexTypeModelBinder.CreateModel(Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext)
+
+ ILLink
+ IL2075
+ member
+ M:Microsoft.AspNetCore.Mvc.ModelBinding.Validation.DefaultUnionValidationStrategy.IsUnionValueProperty(Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata,System.Type)
+
\ No newline at end of file
diff --git a/src/Mvc/Mvc.Core/src/ModelBinding/Metadata/DefaultModelMetadata.cs b/src/Mvc/Mvc.Core/src/ModelBinding/Metadata/DefaultModelMetadata.cs
index 779b3f8d9b0e..58091f8de7ef 100644
--- a/src/Mvc/Mvc.Core/src/ModelBinding/Metadata/DefaultModelMetadata.cs
+++ b/src/Mvc/Mvc.Core/src/ModelBinding/Metadata/DefaultModelMetadata.cs
@@ -478,6 +478,12 @@ internal static bool CalculateHasValidators(HashSet visite
return defaultModelMetadata._hasValidators.Value;
}
+ if (typeof(IUnion).IsAssignableFrom(Nullable.GetUnderlyingType(metadata.ModelType) ?? metadata.ModelType))
+ {
+ // The active case's validators are determined from its runtime type.
+ return true;
+ }
+
if (defaultModelMetadata.ValidationMetadata.HasValidators != false)
{
// Either the ModelMetadata instance has some validators (HasValidators = true) or it is non-deterministic (HasValidators = null).
@@ -555,6 +561,26 @@ public override IReadOnlyList