Skip to content

Add module initializer diagnostics#53523

Merged
BillWagner merged 5 commits into
dotnet:mainfrom
BillWagner:module-initializer-diagnostics
May 1, 2026
Merged

Add module initializer diagnostics#53523
BillWagner merged 5 commits into
dotnet:mainfrom
BillWagner:module-initializer-diagnostics

Conversation

@BillWagner
Copy link
Copy Markdown
Member

@BillWagner BillWagner commented May 1, 2026

BillWagner added 2 commits May 1, 2026 13:15
Add the errors related to module initializers to the diagnostic file about constructors.
BillWagner added 2 commits May 1, 2026 13:34
Make the remediation sections consistent as bullet list items.
@BillWagner BillWagner marked this pull request as ready for review May 1, 2026 17:38
@BillWagner BillWagner requested a review from a team as a code owner May 1, 2026 17:38
Copilot AI review requested due to automatic review settings May 1, 2026 17:38
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 addresses dotnet/docs issue #52836 by moving C# 9 module initializer diagnostics out of the “no specifics” placeholder page and into the existing constructor diagnostics article, plus updating navigation/search metadata to point to the new location.

Changes:

  • Removed module initializer-related f1_keywords entries (CS8813–CS8816, CS8900–CS8902) from the generic “sorry” error page.
  • Updated the C# language-reference TOC entry to reflect module initializer coverage and include the relevant diagnostic IDs in displayName.
  • Expanded constructor-errors.md to include module initializer diagnostics (metadata + a new “Module initializer declarations” section), and updated title/description/date accordingly.

Reviewed changes

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

File Description
docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md Removes module initializer diagnostic IDs now documented elsewhere.
docs/csharp/language-reference/toc.yml Renames the constructors TOC node and adds module initializer diagnostic IDs for discoverability.
docs/csharp/language-reference/compiler-messages/constructor-errors.md Adds module initializer diagnostics and guidance, and updates metadata/title to reflect expanded scope.

Comment thread docs/csharp/language-reference/compiler-messages/constructor-errors.md Outdated
Comment thread docs/csharp/language-reference/compiler-messages/constructor-errors.md Outdated
Comment thread docs/csharp/language-reference/compiler-messages/constructor-errors.md Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@BillWagner BillWagner merged commit 435e0b3 into dotnet:main May 1, 2026
9 checks passed
@BillWagner BillWagner deleted the module-initializer-diagnostics branch May 1, 2026 17:53
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.

[C# 9 diagnostics] module initializers

3 participants