diff --git a/src/Mvc/Mvc.DataAnnotations/src/DataAnnotationsMetadataProvider.cs b/src/Mvc/Mvc.DataAnnotations/src/DataAnnotationsMetadataProvider.cs index 0e975e697f..956f585a75 100644 --- a/src/Mvc/Mvc.DataAnnotations/src/DataAnnotationsMetadataProvider.cs +++ b/src/Mvc/Mvc.DataAnnotations/src/DataAnnotationsMetadataProvider.cs @@ -481,7 +481,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations // See: https://github.com/dotnet/roslyn/blob/master/docs/features/nullable-reference-types.md#annotations if (nullableAttribute.GetType().GetField(NullableFlagsFieldName) is FieldInfo field && field.GetValue(nullableAttribute) is byte[] flags && - flags.Length >= 0 && + flags.Length > 0 && flags[0] == 1) // First element is the property/parameter type. { isNullable = true;