I'm quite not sure about underlying behavior in this case:
public void Test()
{
Method(async () => await Task.Delay(10000));
}
public void Method(Action action)
{
action();
}
A created delegate uses async/await machinery, but inside Method
, action
is called synchronisly and even there is no way to call it in async manner since this delegate doesn't return Task
. So why it's even possible to generate async definition for this delegate? At first glance, only code like:
Method(() => Thread.Sleep(10000));
should be allowed. What did I miss?