Skip to content

Document IDE0410: Use labeled jump statement#54725

Merged
gewarren merged 6 commits into
mainfrom
copilot/document-missing-idexxxx-rules
Jul 9, 2026
Merged

Document IDE0410: Use labeled jump statement#54725
gewarren merged 6 commits into
mainfrom
copilot/document-missing-idexxxx-rules

Conversation

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Adds missing documentation for IDE0410, which flags code that can be simplified using C# 15's labeled break/continue statements.

Changes

  • New ide0410.md: Full rule reference covering:
    • Three detected patterns: gotobreak <label>, gotocontinue <label>, and boolean flag pattern → labeled jump
    • csharp_style_prefer_labeled_jump_statements option (default: true, C# 15+)
    • Code examples for each pattern and suppression instructions
  • index.md: Added IDE0410 row between IDE0391 and IDE1005
  • language-rules.md: Added IDE0410 to the Code-block preferences section
  • toc.yml: Added IDE0410 navigation entry

Example

The rule converts workarounds like this:

// Before: goto pattern
for (int x = 0; x < 10; x++)
{
    for (int y = 0; y < 10; y++)
    {
        if (x * y > 20)
            goto found;
    }
}
found:
Console.WriteLine("Done");

// After: labeled break (C# 15+)
found: for (int x = 0; x < 10; x++)
{
    for (int y = 0; y < 10; y++)
    {
        if (x * y > 20)
            break found;
    }
}
Console.WriteLine("Done");

It also detects boolean flag patterns used to propagate breaks across loop levels, replacing them with a single break <label> or continue <label>.


Internal previews

📄 File 🔗 Preview link
docs/fundamentals/code-analysis/style-rules/ide0410.md Use labeled jump statement (IDE0410)
docs/fundamentals/code-analysis/style-rules/index.md Code-style rules overview
docs/fundamentals/code-analysis/style-rules/language-rules.md Language and unnecessary rules
docs/navigate/tools-diagnostics/toc.yml docs/navigate/tools-diagnostics/toc

Copilot AI requested review from Copilot and removed request for Copilot July 9, 2026 15:44
Copilot AI linked an issue Jul 9, 2026 that may be closed by this pull request
Copilot AI requested review from Copilot and removed request for Copilot July 9, 2026 15:50
Copilot AI requested review from Copilot and removed request for Copilot July 9, 2026 15:50
Copilot AI requested review from Copilot and removed request for Copilot July 9, 2026 15:51
Copilot AI changed the title [WIP] Document missing IDE0043, IDE0390, IDE0391, and IDE1007 rules Document IDE0410: Use labeled jump statement Jul 9, 2026
Copilot AI requested a review from gewarren July 9, 2026 15:52
Comment thread docs/fundamentals/code-analysis/style-rules/ide0410.md Outdated
Comment thread docs/fundamentals/code-analysis/style-rules/ide0410.md Outdated
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 9, 2026 16:10
@gewarren gewarren marked this pull request as ready for review July 9, 2026 16:12
@gewarren gewarren requested a review from a team as a code owner July 9, 2026 16:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the missing documentation for code style rule IDE0410, which encourages using C# 15+ labeled break/continue statements instead of goto-based or flag-based nested-loop control flow, and wires the new page into the existing style-rules navigation and indexes.

Changes:

  • Added a new rule reference page: ide0410.md (overview, option details, examples, and suppression guidance).
  • Updated the style-rules overview index and the language rules list to include IDE0410.
  • Added IDE0410 to the tools-diagnostics TOC so it appears in navigation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
docs/navigate/tools-diagnostics/toc.yml Adds IDE0410 entry to navigation under style rules.
docs/fundamentals/code-analysis/style-rules/language-rules.md Adds IDE0410 to the C# style rules list and updates ms.date.
docs/fundamentals/code-analysis/style-rules/index.md Adds IDE0410 to the rules table and updates ms.date.
docs/fundamentals/code-analysis/style-rules/ide0410.md New documentation page for IDE0410, including option info and examples.

Comment thread docs/fundamentals/code-analysis/style-rules/ide0410.md Outdated
Comment thread docs/fundamentals/code-analysis/style-rules/ide0410.md
Comment thread docs/fundamentals/code-analysis/style-rules/ide0410.md
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@gewarren gewarren enabled auto-merge (squash) July 9, 2026 16:37
@gewarren gewarren merged commit a17f587 into main Jul 9, 2026
11 checks passed
@gewarren gewarren deleted the copilot/document-missing-idexxxx-rules branch July 9, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document missing IDExxxx rules

4 participants