Add StringSyntax formats throughout source code · Issue #44535 · dotnet/aspnetcore (original) (raw)

Is there an existing issue for this?

StringSyntaxAttribute is placed on strings to tell tooling what format the string will take. For example, regex, JSON, XML, date format string, etc. This is then used to provide helpful features such as completion of date format strings, regex/JSON/XML highlighting, analyzers, etc.

We should ensure all the ASP.NET Core strings have this attribute where appropriate, so ASP.NET Core APIs get tooling enhancements.

Describe the solution you'd like

Audit dotnet/aspnetcore source and add StringSyntax attribute with format strings as needed:

This list is from https://github.com/dotnet/runtime/blob/664d7c68d53f2465b79de25fdd6827007216239f/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/StringSyntaxAttribute.cs#L38-L72

I expect many of these won't have any usage - e.g. the format strings (except CompositeFormat) - but we should have Regex, Uri, Json and Xml.

Additional context

No response