Skip to content

Document dotnet_prefer_system_hash_code (IDE0070) and new IDE0221 rule#52975

Merged
gewarren merged 2 commits intomainfrom
copilot/document-editorconfig-style-rules
Apr 13, 2026
Merged

Document dotnet_prefer_system_hash_code (IDE0070) and new IDE0221 rule#52975
gewarren merged 2 commits intomainfrom
copilot/document-editorconfig-style-rules

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 10, 2026

Two EditorConfig style rules introduced in Visual Studio 2026 18.4.0 were undocumented. This PR adds the missing option to IDE0070 and creates the full reference page for IDE0221.

IDE0070 — dotnet_prefer_system_hash_code

The rule already existed but was documented as having no options. The option was added:

  • Updated ide0070.md: added dotnet_prefer_system_hash_code to frontmatter keywords, properties table, and replaced the "no options" placeholder with a proper Options section (true | false, default: true)
  • Updated index.md: linked the option in the rule index table

IDE0221 — dotnet_style_prefer_non_hidden_explicit_cast_in_source

New rule that flags explicit casts where the compiler silently inserts an additional hidden explicit cast. Both casts can fail at runtime independently, so the rule recommends making all intermediate casts visible.

// Violation: compiler inserts a hidden (Base) cast
var v = (Derived)new Castable();

// Fixed: both casts are explicit in source
var v2 = (Derived)(Base)new Castable();
  • Created ide0221.md with full rule reference (C#-only, option true | false, default: true)
  • Added IDE0221 to index.md table, language-rules.md C# expression-level preferences list, and tools-diagnostics/toc.yml
  • Added both new options to the code-style-rule-options.md example EditorConfig

Internal previews

📄 File 🔗 Preview link
docs/fundamentals/code-analysis/code-style-rule-options.md docs/fundamentals/code-analysis/code-style-rule-options
docs/fundamentals/code-analysis/style-rules/ide0070.md docs/fundamentals/code-analysis/style-rules/ide0070
docs/fundamentals/code-analysis/style-rules/ide0221.md docs/fundamentals/code-analysis/style-rules/ide0221
docs/fundamentals/code-analysis/style-rules/index.md docs/fundamentals/code-analysis/style-rules/index
docs/fundamentals/code-analysis/style-rules/language-rules.md docs/fundamentals/code-analysis/style-rules/language-rules
docs/navigate/tools-diagnostics/toc.yml docs/navigate/tools-diagnostics/toc

Copilot AI linked an issue Apr 10, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Document new EditorConfig style rules Document dotnet_prefer_system_hash_code (IDE0070) and new IDE0221 rule Apr 10, 2026
Copilot AI requested a review from gewarren April 10, 2026 20:54
@gewarren gewarren marked this pull request as ready for review April 10, 2026 21:13
@gewarren gewarren requested a review from a team as a code owner April 10, 2026 21:13
Copilot AI review requested due to automatic review settings April 10, 2026 21:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the .NET code style rules documentation to cover two newly introduced EditorConfig options, including adding a new rule reference page for IDE0221 and documenting the previously-undocumented option for IDE0070.

Changes:

  • Documented the dotnet_prefer_system_hash_code option for IDE0070 and linked it from the style rules index.
  • Added a new reference page for IDE0221, including option details and examples.
  • Wired IDE0221 into the relevant navigation/indices (rule index, language rules list, tools diagnostics TOC), and added both options to the example EditorConfig.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/navigate/tools-diagnostics/toc.yml Adds IDE0221 to the tools diagnostics TOC for discoverability.
docs/fundamentals/code-analysis/style-rules/language-rules.md Adds IDE0221 to the C# style rules list.
docs/fundamentals/code-analysis/style-rules/index.md Links IDE0070 and IDE0221 to their documented options in the main rules index table.
docs/fundamentals/code-analysis/style-rules/ide0221.md Introduces the full IDE0221 rule reference page, including option details and examples.
docs/fundamentals/code-analysis/style-rules/ide0070.md Documents the dotnet_prefer_system_hash_code option for IDE0070.
docs/fundamentals/code-analysis/code-style-rule-options.md Adds the two new options to the example EditorConfig snippet.

Copy link
Copy Markdown
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

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

This LGTM. You can :shipit: when ready.

@gewarren gewarren merged commit 3ab803d into main Apr 13, 2026
18 checks passed
@gewarren gewarren deleted the copilot/document-editorconfig-style-rules branch April 13, 2026 18:38
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.

Document new EditorConfig style rules

4 participants