Skip to content

GetValidationAttributes needs updated DAM attributes in Validations source generatorΒ #62655

@captainsafia

Description

@captainsafia

Current generated code:

public static global::System.ComponentModel.DataAnnotations.ValidationAttribute[] GetValidationAttributes(
            [global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
            global::System.Type containingType,
            string propertyName)
{
}

Emits the following warnings:

ValidatableInfoResolver.g.cs(323,45): warning IL2075: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'System.Type.GetConstructors()'. The return value of method 'Microsoft.Extensions.Validation.Generated.ValidationAttributeCache.CacheKey.ContainingType.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-validationIssues related to model validation in minimal and controller-based APIs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions