-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add diagnostics for struct initialization errors #51389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add diagnostics for struct initialization errors #51389
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Updates C# compiler diagnostic documentation by consolidating several constructor/struct-initialization errors into the newer themed “constructor declarations” article, updating navigation, and adding redirects from legacy per-error pages.
Changes:
- Moved CS0132, CS0573, and CS1018 guidance into
constructor-errors.md, and removed the legacy standalone pages. - Updated TOC and “no specifics” fallback page to reflect the new diagnostic coverage.
- Added redirects for removed pages, and refreshed wording in related diagnostic theme pages.
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 diagnostics that now have dedicated guidance elsewhere. |
docs/csharp/misc/cs0573.md |
Removes legacy per-error page (replaced by themed article + redirect). |
docs/csharp/misc/cs0132.md |
Removes legacy per-error page (replaced by themed article + redirect). |
docs/csharp/language-reference/toc.yml |
Re-points diagnostic navigation to the themed constructor article and removes old entries. |
docs/csharp/language-reference/compiler-messages/source-generator-errors.md |
Minor wording updates for consistency. |
docs/csharp/language-reference/compiler-messages/feature-version-errors.md |
Updates the listed CS9041 diagnostic text. |
docs/csharp/language-reference/compiler-messages/cs1018.md |
Removes legacy per-error page (replaced by themed article + redirect). |
docs/csharp/language-reference/compiler-messages/constructor-errors.md |
Major refactor and expansion to include additional constructor/struct-init diagnostics. |
.openpublishing.redirection.csharp.json |
Adds redirects for removed pages to the new themed sections. |
Comments suppressed due to low confidence (1)
docs/csharp/language-reference/compiler-messages/constructor-errors.md:188
- This section heading is
## Constructor declaration, which produces the anchor#constructor-declaration. However, several existing redirects targetconstructor-errors#constructor-declarations(for example,.openpublishing.redirection.csharp.jsonentries for CS0526, CS0710, and CS0824). Rename this heading to## Constructor declarationsor add an explicit anchor so those redirects continue to land on the intended section.
## Constructor declaration
- **CS0526**: *Interfaces cannot contain constructors.*
docs/csharp/language-reference/compiler-messages/constructor-errors.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/feature-version-errors.md
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/constructor-errors.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/constructor-errors.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/constructor-errors.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/constructor-errors.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Meaghan Osagie (Lewis) <[email protected]>
Fixes #49600
In addition, address feedback on #51329 that was posted after merging:
The file for constructor errors was also outdated in style, so do a refactoring to focus on how to fix these diagnostics, and apply current styles.
Internal previews