Skip to content

Document CA1878: Prefer ReadOnlySpan properties over readonly array fields - #55637

Merged
gewarren merged 2 commits into
dotnet:mainfrom
tannergooding:tannergooding-document-ca1878
Aug 26, 2026
Merged

gewarren merged 2 commits into
dotnet:mainfrom
tannergooding:tannergooding-document-ca1878

Conversation

@tannergooding

@tannergooding tannergooding commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

Documents CA1878, including supported element types, target-framework requirements, conservative fixer behavior, suppression guidance, and C# examples.

Adds CA1878 to the quality-rule index, Performance rule list, and diagnostics TOC.

Source: Analyzer behavior and constraints are adapted from dotnet/sdk#55901. The explanatory text and examples are newly authored and should receive analyzer-owner review.

Note

This pull request description was drafted with GitHub Copilot.


Internal previews

File Preview link
docs/fundamentals/code-analysis/quality-rules/ca1878.md Preview published page
docs/fundamentals/code-analysis/quality-rules/index.md Preview published page
docs/fundamentals/code-analysis/quality-rules/performance-warnings.md Preview published page
docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1878.cs Preview published page
docs/navigate/tools-diagnostics/toc.yml Preview published page

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 24, 2026 16:03
@tannergooding
tannergooding requested review from a team and gewarren as code owners August 24, 2026 16:03
@dotnetrepoman dotnetrepoman Bot added this to the August 2026 milestone Aug 24, 2026

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

Adds documentation for the new code analysis rule CA1878 and wires it into the diagnostics navigation and rule indexes so it shows up in the right tables of contents and lists.

Changes:

  • Adds a new reference article for CA1878, including guidance, supported types, framework requirements, and suppression info.
  • Adds a C# snippet file demonstrating a violation and a fix.
  • Updates the diagnostics TOC and Performance/quality-rule indexes to include CA1878.
Show a summary per file
File Description
docs/navigate/tools-diagnostics/toc.yml Adds CA1878 to the diagnostics TOC.
docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/CA1878.cs Adds C# examples for the CA1878 article.
docs/fundamentals/code-analysis/quality-rules/performance-warnings.md Adds CA1878 to the Performance warnings list.
docs/fundamentals/code-analysis/quality-rules/index.md Adds CA1878 to the quality rule index table.
docs/fundamentals/code-analysis/quality-rules/ca1878.md New CA1878 documentation page with examples and guidance.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread docs/fundamentals/code-analysis/quality-rules/ca1878.md Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@gewarren gewarren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for adding this.

@gewarren
gewarren merged commit dfe36d2 into dotnet:main Aug 26, 2026
10 checks passed
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.

3 participants