When you start a Task
using Task.Factory.StartNew()
, the current scheduler is used. What this means is that if you start a Task
this way from a Task
that executes on the UI thread, it will execute on the UI thread too. But the same won't happen if you start a Task
from the UI thread, but outside of a Task
(like in your event handler).
To make sure the Task
is executed on a background thread, you need to explicitly specify you want to use TaskScheduler.Default
.