Unsafe evolution: merge to main#82547
Merged
jjonescz merged 24 commits intodotnet:mainfrom Feb 27, 2026
Merged
Conversation
…81240) Test plan: dotnet#81207 Require unsafe for pointer indirection, member access, and element access when the new memory safety rules are enabled. Unsafe is not required elsewhere (like for pointer types) under the new rules, but more restrictions will be added in follow up PRs, like to also require unsafe for function pointer invocation, etc.
…et#81420) Test plan: dotnet#81207 Everything under section [Existing `unsafe` rules](https://github.com/dotnet/csharplang/blob/main/proposals/unsafe-evolution.md#existing-unsafe-rules) of the speclet should be now handled.
Test plan: dotnet#81207 Inspired by RefSafetyRules attribute. Relevant speclet section: https://github.com/dotnet/csharplang/blob/main/proposals/unsafe-evolution.md#metadata
…ods and properties (dotnet#81581) Test plan: dotnet#81207 More member kinds (besides methods and properties; and also some other types of methods, like synthesized methods) will be handled in a follow up (once this proof of concept is approved). OHI is also not handled in this PR.
…otnet#81698) Test plan: dotnet#81207 Follow up on dotnet#81581 (i.e., still only for methods and properties). 1. Checking lang version. 2. Improving some tests.
Test plan: dotnet#81207 Follow up on dotnet#81581 (i.e., still only for methods and properties). Implements this speclet section: https://github.com/dotnet/csharplang/blob/80f7e032a3131f1d9c2c6822b8a03cf56eeda005/proposals/unsafe-evolution.md#compat-mode
Test plan: dotnet#81207 Only one trivial conflict due to a variable rename from dotnet#81651 (in PEMethodSymbol.cs on line 1042). Plus need to fixup the feature flag otherwise it fails on assert as an unknown feature flag due to dotnet#81591 - commit dotnet@0ae3719.
Test plan: dotnet#81207 Follow up on dotnet#81581 (i.e., still only for methods and properties). Implements this speclet section: https://github.com/dotnet/csharplang/blob/d4a7252e082927c9e6d6f1386d0bb46fa690db8b/proposals/unsafe-evolution.md#extern
No conflicts. Test plan: dotnet#81207
Test plan: dotnet#81207 OHI not handled as part of this PR. Delegates handled according to this open question: https://github.com/dotnet/csharplang/blob/79da45137622071d3c80ebe0a1296387af67afb9/proposals/unsafe-evolution.md#delegate-type-unsafety (i.e., it's not possible to mark delegates as caller-unsafe - I'd expect this to be approved and even if not, it seems like a good starting point - see also comments by jkotas under dotnet/csharplang#9831).
Test plan: dotnet#81207 Implements this part of the speclet: [Overriding, inheritance, and implementation](https://github.com/dotnet/csharplang/blob/61f06216967ed264a8f83c71bff482f3eb6ac113/proposals/unsafe-evolution.md#overriding-inheritance-and-implementation)
Test plan: dotnet#81207 All conflicts resolved in the last commit only. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dibarbet <5749229+dibarbet@users.noreply.github.com> Co-authored-by: Cyrus Najmabadi <cyrus.najmabadi@gmail.com> Co-authored-by: David Barbet <dabarbet@microsoft.com> Co-authored-by: Joseph Musser <me@jnm2.com> Co-authored-by: Joey Robichaud <jorobich@microsoft.com> Co-authored-by: Fred Silberberg <frsilb@microsoft.com> Co-authored-by: dotnet bot <dotnet-bot@dotnetfoundation.org> Co-authored-by: dotnet-policy-service[bot] <123482357+dotnet-policy-service[bot]@users.noreply.github.com> Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com> Co-authored-by: Jason Malinowski <jason.malinowski@microsoft.com> Co-authored-by: DoctorKrolic <mapmyp03@gmail.com> Co-authored-by: DoctorKrolic <70431552+DoctorKrolic@users.noreply.github.com> Co-authored-by: Glen <glen.84@gmail.com> Co-authored-by: David McFarland <corngood@gmail.com> Co-authored-by: AlekseyTs <AlekseyTs@users.noreply.github.com> Co-authored-by: Phil Allen <phillipa@microsoft.com> Co-authored-by: Thomas Shephard <thomas@thomas-shephard.com> Co-authored-by: Cyrus Najmabadi <cyrusn@microsoft.com> Co-authored-by: David Wengier <david.wengier@microsoft.com> Co-authored-by: Julien Couvreur <12466233+jcouv@users.noreply.github.com> Co-authored-by: Tomáš Matoušek <tmat@users.noreply.github.com> Co-authored-by: Ankita Khera <40616383+akhera99@users.noreply.github.com> Co-authored-by: Todd Grunke <toddgrun@microsoft.com> Co-authored-by: Rikki Gibson <rigibson@microsoft.com> Co-authored-by: David Barbet <dibarbet@gmail.com> Co-authored-by: Jason Malinowski <jason@jason-m.com> Co-authored-by: JoeRobich <611219+JoeRobich@users.noreply.github.com> Co-authored-by: Joey Robichaud <joseph.robichaud@microsoft.com> Co-authored-by: ratijas <ratijas.tkachenko@gmail.com> Co-authored-by: cui <cuiweixie@gmail.com> Co-authored-by: Kirill Osenkov <KirillOsenkov@users.noreply.github.com> Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
… some cleanup (dotnet#82456) Test plan: dotnet#81207 Related speclet update: dotnet/csharplang#9999
Test plan: dotnet#81207 No conflicts.
phil-allen-msft
approved these changes
Feb 27, 2026
This was referenced Feb 27, 2026
This was referenced Mar 3, 2026
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test plan: #81207
Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/unsafe-evolution.md
Proposal issue: dotnet/csharplang#9704
The last commit trivially resolves remaining PROTOTYPE comments (compacting numbers and using tracking issue for the rest).