Skip to content

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

@BillWagner

Description

@BillWagner

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

  • Add to What's new in C# 13: Add links to updated docs in the What's new in C# 13 article.
  • Update language reference: Detail the areas in the language reference that will be updated for this feature.
  • Update compiler messages: Add new (or updated) pages for new compiler messages. Include related message.
  • Include in Everyday C# section*: Is this new feature included in Everyday C#?
  • Tutorials: Are new tutorials required for this feature? If so, detail below

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions