I added the following line (exactly as is, so you can try it too) to an asp.net WebApi action:
new SmtpClient { DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory}.SendMailAsync("a@test.com", "b@test.com", "s", "b");
and it caused the action to wait a few seconds, until throwing a 500 error of An asynchronous module or handler completed while an asynchronous operation was still pending.
Clearly asp.net detected that there was an asynchronous task running.
Yet when I add
Task.Delay(10000);
the action completes immediately. Why does asp.net not detect here that there is an asynchronous task running?