Skip to content

Add StringSyntax format attributes to methods and parameters #62179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 30, 2025

This PR adds StringSyntaxAttribute annotations to various methods and parameters throughout the codebase.

These attributes help provide better tooling support in IDEs by annotating string parameters that are expected to have specific formats. The annotations enable better syntax highlighting, autocompletion, and validation when working with specific string formats.

The PR adds annotations for the following format types that were missing from previous work:

  • EnumFormat - Applied to string parameters that expect enum format specifiers
  • GuidFormat - Applied to string parameters that expect GUID format specifiers
  • NumericFormat - Applied to string parameters that expect numeric format specifiers
  • TimeSpanFormat - Applied to string parameters that expect TimeSpan format specifiers

Changes made:

  • Added [StringSyntax(StringSyntaxAttribute.EnumFormat)] to enum format parameters in ModelExplorerExtensions and TemplateBuilder
  • Added [StringSyntax(StringSyntaxAttribute.NumericFormat)] to numeric format parameters in IHtmlGenerator
  • Added using System.Diagnostics.CodeAnalysis where needed

Fixes #44535.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor

Greetings human! You've submitted a PR that modifies code that is shared with https://github.com/dotnet/runtime . Please make sure you synchronize this code with the changes in that repo!

@Copilot Copilot AI changed the title [WIP] Add StringSyntax formats throughout source code Add StringSyntax format attributes to methods and parameters May 30, 2025
@Copilot Copilot AI requested a review from danmoseley May 30, 2025 14:27
Copilot finished work on behalf of danmoseley May 30, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add StringSyntax formats throughout source code
2 participants