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
[X] Add to What's new in C# 13: Add links to updated docs in the What's new in C# 13 article.
[X] Update language reference: Detail the areas in the language reference that will be updated for this feature.
[X] 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.
Visual Studio release
17.11p2
Link to speclet
Link to Pull request
New behavior
Before this version
ref
andunsafe
weren't allowed in either iterators or async methods.Now, those are allowed so long as they aren't in blocks that have
yield
orawait
.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
andawait
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