C#

C#

By DeepSource

Async methods should not have a return type of void CS-R1005

Anti-pattern

An async method with return type void does not provide any reliable way to know if the intended task has been completed or not. It is a fire-and-forget method and provides no reliable way to handle any Exceptions should things go wrong. It is therefore suggested that your method have a return type Task.

Bad Practice

public async void ParallelProcessData(Data data)
{
    // ...
}

Recommended

public async Task ParallelProcessData(Data data)
{
    // ...
}

Reference