Skip to content

ComponentBase Async Methods aren't Async by Default #10973

Closed
@kevinjpetersen

Description

@kevinjpetersen

Describe the bug

In the "@functions" section of a Blazor Component, when using the auto complete of the virtual async methods (That can be overriden), the generated code from the auto complete doesn't have an "async" tag on the method.

To Reproduce

Steps to reproduce the behavior:

  1. Using ASP.NET Core 3.0 Preview 5
  2. Add a "@functions" section to a Blazor Component
  3. Auto complete a virtual method to override it (Example: OnAfterRenderAsync)

Expected behavior

The auto completed method would include the "async" tag on the method.

Code Details

// Produced
protected override Task OnAfterRenderAsync()
{
	return base.OnAfterRenderAsync();
}

// Expected
protected override async Task OnAfterRenderAsync()
{
	await base.OnAfterRenderAsync();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalThis is an issue in a component not contained in this repository. It is open for tracking purposes.area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions