dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.17k stars 5.83k forks source link

[C# 13]: New Feature - Allow ref and unsafe in iterators and async #41204

Open BillWagner opened 1 month ago

BillWagner commented 1 month ago

Visual Studio release

17.11p2

Link to speclet

Link to Pull request

New behavior

Before this version ref and unsafe weren't allowed in either iterators or async methods.

Now, those are allowed so long as they aren't in blocks that have yield or await.

This one is somewhat complex to describe for readers not intimately familiar with captured contexts and how the compiler lowers iterators and async methods.

Areas affected

Language reference tasks

The pages for ref struct, yield, async and await will need updates to explain this feature.

The corresponding programming guide pages may need to be checked to see if any of the language describing any of these features describe the existing restrictions.

Tutorial tasks

No response

Everyday C# tasks

No response


Associated WorkItem - 259674

BillWagner commented 4 days ago

As part of updating and consolidating error messages, 11 articles were removed. (net 10)