-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add help for C# 11 ref safety errors #50090
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
Conversation
Give the edits a final proofread
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
This PR adds comprehensive documentation for C# 11 ref safety errors by splitting the existing ref-modifiers-errors.md file into two focused documents. The new ref-safety-errors.md file specifically covers ref safety violations related to escape scopes, ref assignments, and struct member restrictions, while ref-modifiers-errors.md now focuses solely on reference parameter modifier usage errors.
Key changes:
- Created
ref-safety-errors.mdto document 29 error codes related to ref safety violations (CS8166-CS9097 range) - Reorganized
ref-modifiers-errors.mdto remove ref safety content and add scoped/unscoped parameter errors - Updated TOC to include the new ref safety errors section with appropriate error code mappings
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/csharp/language-reference/compiler-messages/ref-safety-errors.md | New file documenting ref safety errors organized into four thematic sections: returning references with incompatible scopes, ref assignments, escape scope violations, and struct member restrictions |
| docs/csharp/language-reference/compiler-messages/ref-modifiers-errors.md | Updated to remove ref safety content (moved to new file) and add scoped/unscoped parameter error documentation with corrected frontmatter |
| docs/csharp/language-reference/toc.yml | Added new "Ref safety" entry and updated "Reference parameters" entry to reflect the error code reorganization |
| docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md | Removed 34 error codes that are now documented in the new ref safety and updated ref modifiers files |
| .github/prompts/error-consolidation.md | Minor wording correction changing "table" to "list" for clarity |
Comments suppressed due to low confidence (1)
docs/csharp/language-reference/compiler-messages/ref-modifiers-errors.md:63
- Missing CS8977 and CS8986 from the f1_keywords section. CS8977 appears in helpviewer_keywords (line 93) and CS8986 is documented in the article (line 151), but both are missing from f1_keywords. Both sections should include all documented error codes.
f1_keywords:
- "CS0192"
- "CS0199"
- "CS0206"
- "CS0631"
- "CS0767"
- "CS1510"
- "CS1605"
- "CS1623"
- "CS1649"
- "CS1651"
- "CS1655"
- "CS1657"
- "CS1741"
- "CS1939"
- "CS1988"
- "CS7084"
- "CS8196"
- "CS8325"
- "CS8326"
- "CS8327"
- "CS8329"
- "CS8330"
- "CS8331"
- "CS8332"
- "CS8337"
- "CS8338"
- "CS8373"
- "CS8388"
- "CS8987"
- "CS9061"
- "CS9062"
- "CS9063"
- "CS9065"
- "CS9066"
- "CS9072"
- "CS9073"
- "CS9074"
- "CS9101"
- "CS9102"
- "CS9104"
- "CS9104"
- "CS9104"
- "CS9104"
- "CS9104"
- "CS9104"
- "CS9104"
- "CS9190"
- "CS9191"
- "CS9192"
- "CS9193"
- "CS9195"
- "CS9196"
- "CS9197"
- "CS9198"
- "CS9199"
- "CS9200"
- "CS9201"
- "CS9205"
- "CS9265"
docs/csharp/language-reference/compiler-messages/ref-modifiers-errors.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/ref-safety-errors.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/ref-safety-errors.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/ref-modifiers-errors.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/ref-modifiers-errors.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
…into ref-safety-errors
docs/csharp/language-reference/compiler-messages/ref-modifiers-errors.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/ref-modifiers-errors.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/ref-modifiers-errors.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/compiler-messages/ref-modifiers-errors.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Genevieve Warren <[email protected]>
Fixes #49598
Some of these had already been covered. To manage the scope, split one existing file into two.
Internal previews