Skip to content

Consider relaxing restrictions of async methods in blocks that do not contain await. (VS 17.11, .NET 9) #1331

@VSadov

Description

@VSadov

Async methods have several restrictions such as not allowing ref and ref-like/span locals.

The reason is the technical difficulties that may arise if such locals need to be hoisted. In a code that tries to mix await and span this could be inconvenient.

Besides there can be patterns which are obviously safe - In particular, in a block that does not contain await expressions, such locals would never be hoisted and therefore we could relax the restrictions.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions