Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Inconsistencies in RequiresAttribute argument validation #2554

Open

Description

@sbomer

When checking for RequiresAttribute, we sometimes validate the arguments, and sometimes don't (look for VerifyAttributeArguments - currently this is only called when looking for attributes on the ctor of a type substituted for a generic parameter with a new constraint).

We should be consistent - most likely by validating the attribute arguments for every RequiresAttribute instance.

Activity

  1. vitek-karas commented on Jan 28, 2022

    @vitek-karas
    Member

    There were some problems with the implementation - I remember discussing this with @tlakollo . We intentionally split the validation - but I don't remember the details.

  2. sbomer commented on Jan 31, 2022

    @sbomer
    MemberAuthor

    @vitek-karas in #2553 (comment)

    In @tlakollo PR there will be a single method to do this at once: https://github.com/dotnet/linker/pull/2418/files#diff-6417c9266a49f206907dd0ece745dc0c77c5f5c9a0c92ec3bb749d4c8e2c039aR14-R15
    Please make sure we end up using it here as well.

    @vitek-karas in #2553 (comment)

    I'm thinking a safer thing would be to call "Validate" on the attribute as well - it basically checks that the attribute is in the form we recognize. As a safe guard against potential future changes which could for example add some kind of "feature condition" to the RUC attribute (I know we've discussed this), in which case the attribute is not always "active", so it's safer to NOT recognize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions