Skip to content

Add language reference material for unsafe updates for memory safety#54367

Draft
BillWagner wants to merge 3 commits into
dotnet:mainfrom
BillWagner:unsafe-2-reference
Draft

Add language reference material for unsafe updates for memory safety#54367
BillWagner wants to merge 3 commits into
dotnet:mainfrom
BillWagner:unsafe-2-reference

Conversation

Use the preferred terms for memory safety.
Copilot AI review requested due to automatic review settings June 12, 2026 16:12
@dotnetrepoman dotnetrepoman Bot added this to the June 2026 milestone Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 C# 15 (preview) documentation for the evolving memory safety model around unsafe, and wires the related feature-spec proposal into the documentation set.

Changes:

  • Adds a new “Memory safety” section to the C# 15 “What’s new” page.
  • Adds a “Memory safety (preview)” section to the unsafe code reference and updates related keyword/operator/statement reference pages.
  • Adds a new C# snippet project used by the memory safety docs, and updates docfx/toc wiring for the proposal.

Reviewed changes

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

Show a summary per file
File Description
docs/csharp/whats-new/csharp-15.md Adds a C# 15 “Memory safety” feature overview and link to the spec/proposal.
docs/csharp/specification/toc.yml Adds a “Unsafe code > Memory safety” entry under feature specifications.
docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md Renames an internal keyword grouping comment from “unsafe evolution” to “memory safety”.
docs/csharp/language-reference/unsafe-code.md Adds “Memory safety (preview)” reference content and snippet inclusions.
docs/csharp/language-reference/statements/fixed.md Adds a note about the preview relaxations for fixed.
docs/csharp/language-reference/snippets/memory-safety/Relaxations.cs New snippet source demonstrating memory safety relaxations.
docs/csharp/language-reference/snippets/memory-safety/Program.cs New entry point to build/verify the snippet project.
docs/csharp/language-reference/snippets/memory-safety/memory-safety.csproj New snippet project targeting net11.0 with LangVersion=preview.
docs/csharp/language-reference/operators/stackalloc.md Adds a note about preview relaxations for stackalloc→pointer conversion.
docs/csharp/language-reference/operators/sizeof.md Adds a note about preview relaxations for sizeof on unmanaged types.
docs/csharp/language-reference/operators/pointer-related-operators.md Adds a note about preview relaxations for the address-of operator.
docs/csharp/language-reference/keywords/unsafe.md Adds a summary note about the memory safety preview changes.
docfx.json Adds the unsafe-evolution proposal to proposal content/title/description mappings.

Comment thread docs/csharp/language-reference/statements/fixed.md Outdated
Comment thread docs/csharp/language-reference/operators/pointer-related-operators.md Outdated
Comment thread docs/csharp/language-reference/operators/stackalloc.md Outdated
Comment thread docs/csharp/language-reference/keywords/unsafe.md Outdated
Comment thread docs/csharp/language-reference/unsafe-code.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C# 15-Fundamentals and reference]: New Feature - Improved memory safety

2 participants