Add diagnostics for Main and top level statements - #52598
Merged
Conversation
Consolidate existing error diagnostics into this file.
Search for additional errors related to this theme.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates C# compiler diagnostics related to program entry points into a single guidance article, including Main method rules, the StartupObject (/main) option, and top-level statement diagnostics, and updates navigation and redirects accordingly.
Changes:
- Add a new consolidated article for entry point–related diagnostics (
Main,StartupObject, and top-level statements). - Remove older per-diagnostic pages that are now covered by the consolidated article, and update redirects and TOC entries.
- Update the “no specifics” catch-all page to remove diagnostics that now have dedicated guidance.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/csharp/language-reference/compiler-messages/entry-point-errors.md | New consolidated guidance for entry point diagnostics (Main/StartupObject/top-level statements). |
| docs/csharp/language-reference/toc.yml | Adds a “Program entry point” node and removes TOC entries for deleted per-diagnostic pages. |
| .openpublishing.redirection.csharp.json | Adds redirects from deleted per-diagnostic pages to the consolidated article. |
| docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md | Removes F1 keywords for diagnostics that are now covered by the consolidated article. |
| docs/csharp/misc/cs0017.md | Deleted (content consolidated into entry-point-errors.md). |
| docs/csharp/misc/cs0028.md | Deleted (content consolidated into entry-point-errors.md). |
| docs/csharp/misc/cs0402.md | Deleted (content consolidated into entry-point-errors.md). |
| docs/csharp/misc/cs1555.md | Deleted (content consolidated into entry-point-errors.md). |
| docs/csharp/misc/cs1556.md | Deleted (content consolidated into entry-point-errors.md). |
| docs/csharp/misc/cs1557.md | Deleted (content consolidated into entry-point-errors.md). |
| docs/csharp/misc/cs1558.md | Deleted (content consolidated into entry-point-errors.md). |
| docs/csharp/misc/cs1559.md | Deleted (content consolidated into entry-point-errors.md). |
| docs/csharp/misc/cs2017.md | Deleted (content consolidated into entry-point-errors.md). |
| docs/csharp/misc/cs5001.md | Deleted (content consolidated into entry-point-errors.md). |
| docs/csharp/language-reference/compiler-messages/cs8802.md | Deleted (content consolidated into entry-point-errors.md). |
| docs/csharp/language-reference/compiler-messages/cs8803.md | Deleted (content consolidated into entry-point-errors.md). |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Member
Author
|
Let's try closing / reopening again |
gewarren
approved these changes
Mar 25, 2026
BillWagner
commented
Mar 25, 2026
BillWagner
commented
Mar 25, 2026
BillWagner
commented
Mar 25, 2026
Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributes to #51450
Add errors for top level statements, and consolidate all related errors for Main methods and program entry points in general.
Internal previews