Skip to content

"Generate abstract method" adds disallowed async modifier #80628

@jhinder

Description

@jhinder

Version Used: 18.0.0 Insiders [11104.47]

Steps to Reproduce:

Open the lightbulb menu on the identifier M2 and select "Generate abstract method 'M2'".

abstract class C
{
    async Task M()
    {
        await M2();
    }
}

Expected Behavior:
A valid abstract method declaration is inserted:

protected abstract Task M2();

Actual Behavior:
The async modifier is added to the method declaration, resulting in error CS1994

protected abstract async Task M2(); // CS1994: The 'async' modifier can only be used in methods that have a body.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions