-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Runtimecode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzer
Milestone
Description
#62995 added the new StringSyntaxAttribute, and we annotated a bunch of APIs with it, for the three syntaxes currently identified: Regex, DateTimeFormat, and Json.
Visual Studio will look for these and use it to influence its colorization, IntelliSense, etc., but we can also use them to help warn developers at dev time / build time when they've written something that will produce run-time failures. We can add an analyzer for each syntax that will warn on the literal provided, e.g. these would warn
var r = new Regex("[abc"); // Invalid pattern '[abc' at offset 4. Unterminated [] set.
DateTime.ParseExact(DateTime.Now.ToString(), "c", null); // Invalid format specifierMetadata
Metadata
Assignees
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Runtimecode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzer