I have a group of commands that inherit from a base class. The base class has the following declaration:
public virtual async Task Execute(object parameter){}
Inheriting classes provide an override of this method and not all of them await tasks. In these cases the compiler generates a warning:
This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
Is it correct to explicitly provide a task complete return value?
public override async Task Execute(object parameter) {
//code containing no await statements...
await Task.CompletedTask;
}