Open
Description
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
- Look at the parameters of the invoked method for a parameter with StringSyntaxAttribute
- If found, look at the argument corresponding to that parameter.
- 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