I could find out that, Task.Run
executes always on threads from .NET Framework threads pool (TaskScheduler.Default
). I suppose, that it is the same with Task.Delay
, but I'm not sure.
MSDN says for Task.Delay
only:
Creates a task that will complete after a time delay
Therefore the question: Where (in which synchronization context) runs Task.Delay
?
Task.Delay
doesn't run anywhere. It just creates a task that completes after the specified time. UnlikeTask.Run
it's not accepting a delegate of yours to run somewhere. Most tasks won't represent the execution of some method on another thread.Task.Run
is one of few methods that do that.