mvc invalidOperationException: Method 'InvokeAsync' of view component should be declared to return Task<t> code example
Example: mvc invalidOperationException: Method 'InvokeAsync' of view component should be declared to return Task
public class ExampleViewComponent : ViewComponent {
public Task InvokeAsync() {
ExampleModel model = new ExampleModel(2);
// returns a finished task
return Task.FromResult(View(model));
}
}