Microsoft is tightening restrictions on the use of unsafe code in C#

TL;DR AI
2 min readKey summary
Microsoft is redesigning C#’s unsafe code model so risky memory operations are marked more explicitly, rather than with broad class- or file-level annotations.
The new approach starts as optional, but it will apply immediately to .NET runtime libraries and preview in C# 15/.NET 11 before a fuller release in C# 16/.NET 12.
The goal is to make pointer and memory risks easier to spot in code review and tooling, especially as AI-generated code becomes more common.
The shift aims to improve safety without breaking existing apps right away, nudging C# toward stricter Rust-like practices over time.
