Task.Run generates a new thread in most scenarios, as I understand it.
It is important to note that simply because you mark the async method and use awaiters, this does NOT (necessarily) mean that new threads are created, improvements are scheduled in the SAME, the executable from which they were called from in many cases.
The trick here is related to the SchedulingContext. If it is installed for a multi-threaded apartment, then you are going to delegate the improvements to viable threads in threadpool. If you are in a single-threaded apartment, since all the user interfaces are WPF and WinForms, then it will return to the calling thread to complete, which allows you to work directly in the user interface without visible sorting of lines in the code.
Firoso
source share