Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tarekgh opened this issue Oct 12, 2023 · 2 comments
Assignees
Labels
area-Extensions-Options source-generator Indicates an issue with a source generator feature
Milestone

Comments

@tarekgh
Copy link
Member

tarekgh commented Oct 12, 2023

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.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Oct 12, 2023
@ghost
Copy link

ghost commented Oct 12, 2023

Tagging subscribers to this area: @dotnet/area-system-componentmodel-dataannotations
See info in area-owners.md if you want to be subscribed.

Issue Details

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.

Author: tarekgh
Assignees: -
Labels:

area-System.ComponentModel.DataAnnotations

Milestone: -

@tarekgh tarekgh added area-Extensions-Options and removed area-System.ComponentModel.DataAnnotations untriaged New issue has not been triaged by the area owner labels Oct 12, 2023
@tarekgh tarekgh added this to the 8.0.0 milestone Oct 12, 2023
@ghost
Copy link

ghost commented Oct 12, 2023

Tagging subscribers to this area: @dotnet/area-extensions-options
See info in area-owners.md if you want to be subscribed.

Issue Details

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.

Author: tarekgh
Assignees: -
Labels:

area-Extensions-Options

Milestone: -

@tarekgh tarekgh self-assigned this Oct 12, 2023
@tarekgh tarekgh added the source-generator Indicates an issue with a source generator feature label Oct 12, 2023
@ghost ghost added in-pr There is an active PR which will close this issue when it is merged and removed in-pr There is an active PR which will close this issue when it is merged labels Oct 13, 2023
@tarekgh tarekgh closed this as completed Oct 13, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Extensions-Options source-generator Indicates an issue with a source generator feature
Projects
None yet
Development

No branches or pull requests

1 participant