Skip to content

ComponentBase Async Methods aren't Async by Default #10973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kevinjpetersen opened this issue Jun 6, 2019 · 1 comment
Closed

ComponentBase Async Methods aren't Async by Default #10973

kevinjpetersen opened this issue Jun 6, 2019 · 1 comment
Labels
area-blazor Includes: Blazor, Razor Components External This is an issue in a component not contained in this repository. It is open for tracking purposes.

Comments

@kevinjpetersen
Copy link

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();
}
@rynowak
Copy link
Member

rynowak commented Jun 7, 2019

This is the same as the behavior of all C#. I'd suggest reporting this suggestion at https://github.com/dotnet/Roslyn

@rynowak rynowak added the External This is an issue in a component not contained in this repository. It is open for tracking purposes. label Jun 7, 2019
@Eilon Eilon added the area-blazor Includes: Blazor, Razor Components label Jun 7, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components External This is an issue in a component not contained in this repository. It is open for tracking purposes.
Projects
None yet
Development

No branches or pull requests

4 participants