Do you have to put Task.Run in a method to make it async?

First, let’s clear up some terminology: “asynchronous” (async) means that it may yield control back to the calling thread before it starts. In an async method, those “yield” points are await expressions. This is very different than the term “asynchronous”, as (mis)used by the MSDN documentation for years to mean “executes on a background thread”. … Read more

Does the use of async/await create a new thread?

In short NO From Asynchronous Programming with Async and Await : Threads The async and await keywords don’t cause additional threads to be created. Async methods don’t require multithreading because an async method doesn’t run on its own thread. The method runs on the current synchronization context and uses time on the thread only when … Read more

Using async-await on .net 4

Microsoft released the Async Targeting Pack (Microsoft.Bcl.Async) through Nuget as a replacement for the AsyncCTP. You can read more about it here: http://blogs.msdn.com/b/bclteam/archive/2013/04/17/microsoft-bcl-async-is-now-stable.aspx. You can read about the previous version here: http://blogs.msdn.com/b/lucian/archive/2012/04/24/async-targeting-pack.aspx. As this pack is officially supported, I now believe the best option for targeting XP + async would be using Visual Studio 2012 … Read more

How would I run an async Task method synchronously?

Here’s a workaround I found that works for all cases (including suspended dispatchers). It’s not my code and I’m still working to fully understand it, but it does work. It can be called using: customerList = AsyncHelpers.RunSync<List<Customer>>(() => GetCustomers()); Code is from here public static class AsyncHelpers { /// <summary> /// Execute’s an async Task<T> … Read more