Skip to content

Document C# 8 misc diagnostics#54812

Open
BillWagner wants to merge 6 commits into
dotnet:mainfrom
BillWagner:misc-csharp8-diagnostics
Open

Document C# 8 misc diagnostics#54812
BillWagner wants to merge 6 commits into
dotnet:mainfrom
BillWagner:misc-csharp8-diagnostics

Conversation

@BillWagner

@BillWagner BillWagner commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

Documents the remaining C# 8 miscellaneous compiler diagnostics from #54660 by folding each into a themed consolidated compiler-message article and removing it from the sorry-we-don-t-have-specifics catch-all.

New consolidated articles

File Codes
static-local-function-errors.md CS8421
index-range-errors.md CS8428, CS8429
parsing-errors.md (scoped to parser/lexer-stage errors) CS8635, CS8641
readonly-member-errors.md CS8656, CS8662

Added to existing articles

File Codes
attribute-usage-errors.md CS8423
interface-implementation-errors.md CS8646
nullable-warnings.md CS8650, CS8651, CS8669

Notes

  • The issue listed CS8556, which does not exist in Roslyn. The correct readonly-member warning is CS8656 (WRN_ImplicitCopyInReadOnlyMember).
  • CS8669 was listed under "readonly struct members" but is a nullable-context/generated-code warning, so it landed in nullable-warnings.md.
  • CS8650/CS8651 (nullable ref type in is/as) placed in nullable-warnings.md since the rule concerns nullable-reference-type annotations.
  • parsing-errors.md is deliberately scoped to parser/lexer-stage diagnostics only (not a general "syntax errors" catch-all).
  • All 12 codes removed from the catch-all; TOC updated; every message verified verbatim against Roslyn source.

Closes #54660


Follow-up: broadened three articles to full themes

Three of the new articles were expanded to cover their complete themes (conservative scope — only undocumented/standalone codes brought in; codes already living in other consolidated articles are cross-referenced in prose):

Renamed to Theme Codes added
local-function-errors.md (was static-local-function-errors) All local-function diagnostics CS8108, CS8112, CS8321, CS8422*
indexer-access-errors.md (was index-range-errors) Indexer and element access CS0021, CS0154, CS0271, CS0272, CS0856, CS0857, CS1545, CS1546*
readonly-struct-errors.md (was readonly-member-errors) Readonly struct declarations and members CS8340, CS8342

*CS8422 and CS1546 were standalone articles, now merged with redirects.


Internal previews

📄 File 🔗 Preview link
docs/csharp/language-reference/compiler-messages/attribute-usage-errors.md Resolve errors and warnings related to attribute declarations or attribute use in your code
docs/csharp/language-reference/compiler-messages/indexer-access-errors.md "Resolve errors and warnings related to indexer and element access"
docs/csharp/language-reference/compiler-messages/interface-implementation-errors.md Resolve errors and warnings related to members that implement an interface
docs/csharp/language-reference/compiler-messages/local-function-errors.md docs/csharp/language-reference/compiler-messages/local-function-errors
docs/csharp/language-reference/compiler-messages/nullable-warnings.md Nullable reference type warnings
docs/csharp/language-reference/compiler-messages/parsing-errors.md "Resolve errors related to parsing C# code"
docs/csharp/language-reference/compiler-messages/readonly-struct-errors.md Resolve errors and warnings related to readonly structs and members
docs/csharp/language-reference/toc.yml docs/csharp/language-reference/toc
docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md Coming in C# 15

Consolidate the remaining C# 8 miscellaneous compiler diagnostics into
themed compiler-message articles and remove them from the catch-all.

New consolidated articles:
- static-local-function-errors.md (CS8421)
- index-range-errors.md (CS8428, CS8429)
- parsing-errors.md (CS8635, CS8641) — scoped to parser/lexer-stage errors
- readonly-member-errors.md (CS8656, CS8662)

Added to existing articles:
- attribute-usage-errors.md: CS8423
- interface-implementation-errors.md: CS8646
- nullable-warnings.md: CS8650, CS8651, CS8669

Removed all 12 codes from the sorry-we-don-t-have-specifics catch-all and
added TOC entries for the new articles. Messages verified against Roslyn
source. Note: the issue listed CS8556, which does not exist; the correct
readonly-member warning is CS8656.

Closes dotnet#54660

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5d7745fb-b209-4027-a20d-793310218421
Copilot AI review requested due to automatic review settings July 16, 2026 14:39
@BillWagner
BillWagner requested a review from a team as a code owner July 16, 2026 14:39
@dotnetrepoman dotnetrepoman Bot added this to the July 2026 milestone Jul 16, 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

This PR documents the remaining C# 8 miscellaneous compiler diagnostics from #54660 by moving each diagnostic into a themed, consolidated compiler-message article, updating related existing articles, and removing the diagnostics from the “sorry-we-don’t-have-specifics” catch-all list.

Changes:

  • Added four new consolidated compiler-message articles covering CS8421, CS8428/CS8429, CS8635/CS8641, and CS8656/CS8662.
  • Updated existing compiler-message articles to include CS8423, CS8646, CS8650/CS8651, and CS8669.
  • Updated the C# language reference TOC and removed the 12 codes from the catch-all page’s f1_keywords list.

Reviewed changes

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

Show a summary per file
File Description
docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md Removes C# 8 misc diagnostic codes from the catch-all f1_keywords list.
docs/csharp/language-reference/toc.yml Adds TOC entries for the new consolidated articles and updates displayName keyword lists to include moved codes.
docs/csharp/language-reference/compiler-messages/static-local-function-errors.md New consolidated article for CS8421 (static local functions).
docs/csharp/language-reference/compiler-messages/index-range-errors.md New consolidated article for CS8428/CS8429 (index and range expressions).
docs/csharp/language-reference/compiler-messages/parsing-errors.md New consolidated article for CS8635/CS8641 (parser/lexer-stage errors).
docs/csharp/language-reference/compiler-messages/readonly-member-errors.md New consolidated article for CS8656/CS8662 (readonly struct member diagnostics).
docs/csharp/language-reference/compiler-messages/nullable-warnings.md Adds CS8650/CS8651 and CS8669 content and updates keyword metadata and date.
docs/csharp/language-reference/compiler-messages/interface-implementation-errors.md Adds CS8646 coverage and updates keyword metadata and date.
docs/csharp/language-reference/compiler-messages/attribute-usage-errors.md Adds CS8423 coverage and updates keyword metadata and date.

Comment thread docs/csharp/language-reference/compiler-messages/nullable-warnings.md Outdated
Comment thread docs/csharp/language-reference/toc.yml Outdated
BillWagner and others added 4 commits July 16, 2026 11:09
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Follow-up to the C# 8 misc diagnostics work: expand three of the new
consolidated articles to cover their full themes (conservative scope —
bring in undocumented/standalone codes only; cross-reference codes that
already live in other consolidated articles).

- static-local-function-errors.md -> local-function-errors.md:
  all local-function diagnostics. Adds CS8108, CS8112, CS8321, and merges
  standalone CS8422 (with redirect).
- index-range-errors.md -> indexer-access-errors.md: indexer and element
  access. Adds CS0021, CS0154, CS0271, CS0272, CS0856, CS0857, CS1545, and
  merges standalone CS1546 (with redirect).
- readonly-member-errors.md -> readonly-struct-errors.md: readonly struct
  declarations and members. Adds CS8340, CS8342.

Updates TOC entries and titles for the renames, removes the added codes
from the catch-all, and cross-references related diagnostics that remain
in their existing articles. Messages verified against Roslyn source.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5d7745fb-b209-4027-a20d-793310218421
- Fix "surpress" -> "suppress" typo in nullable-warnings.md.
- Use sentence case for the readonly structs and members TOC entry.

The ai-usage disclosure on nullable-warnings.md was already added in a
prior autofix commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5d7745fb-b209-4027-a20d-793310218421
Comment thread docs/csharp/language-reference/compiler-messages/local-function-errors.md Outdated
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.

[C# diagnostics] C# 8 misc errors

2 participants