Skip to content

Conversation

Copy link
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 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.md to document 29 error codes related to ref safety violations (CS8166-CS9097 range)
  • Reorganized ref-modifiers-errors.md to 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"

Co-authored-by: Genevieve Warren <[email protected]>
@BillWagner BillWagner enabled auto-merge (squash) November 25, 2025 14:14
@BillWagner BillWagner merged commit 7a59012 into dotnet:main Nov 25, 2025
9 checks passed
@BillWagner BillWagner deleted the ref-safety-errors branch November 25, 2025 14:24
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.

Add C# 11 errors for ref safety violations

2 participants