'Get Task reference to void async method
I have a working .NET5 c# code like below:
class dummy
{
public async Task CommandAsync(string command, Action<DataTable> action)
{...}
}
Above is compiled in a library referenced from another project, and the method is called as below:
var d = dummy();
var commandTask = d.CommandAsync("some command", ProcessResult);
while (!commandTask.Wait(100)) Console.Write(".");
The key point here is that I can get the reference to the Task from a void async function. Above works correctly.
Today when I am trying to write another app, I ran into this error:

Not sure if any difference, but the issue is that now I can't find the way to get the reference to the Task executing the void method RunAsync.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
