Skip to content

[Analyzer Proposal]: Propagate StringSyntaxAttribute #110305

Open
@Youssef1313

Description

@Youssef1313

Background and motivation

StringSyntaxAttribute was introduced to support IDE highlighting scenarios, such as Regex.

Often, users have existing helper methods that may be forwarding a parameter to a method (likely a BCL method, e.g Regex.IsMatch) that has the attribute, but the user doesn't add the attribute.

API Proposal

An analyzer is introduced that will analyze invocations and roughly have the following functionality

  1. Look at the parameters of the invoked method for a parameter with StringSyntaxAttribute
  2. If found, look at the argument corresponding to that parameter.
  3. If the argument is an IParameterReferenceOperation, look into the attributes of that parameter and require a matching attribute.

API Usage

N/A

Alternative Designs

No response

Risks

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions