Skip to content

Options source gen produce diagnostics with LengthAttribute when applied on properties of interface type #93403

@tarekgh

Description

@tarekgh

When using something like the following:

    [System.ComponentModel.DataAnnotations.Length(1, int.MaxValue)]
    public IList<Foo> Property { get; set; }

The options source gen will produce diagnostics

error SYSLIB1217: The validation attribute LengthAttribute should only be applied to properties of type string, array, or ICollection. Using it with the type IList could lead to runtime failures. 

This is a regression from the changes in #93088.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions