Consider the following (based on the default MVC template), which is a simplified version of some \"stuff\" that happens in the background - it completes fine, and shows the
When you use .Result there is always a possibility of deadlock because .Result is blocking by nature. The way to avoid deadlocks is to not block on Tasks (you should use async and await all the way down). The subject is in details described here:
One fix is to add ConfigureAwait:
public static async Task IndirectSlowDouble(long val)
{
long result = await SlowDouble(val).ConfigureAwait(false);
return result;
}