"var myValue = DoSomethingAsync().ConfigureAwait(false).Result;"
In my view there should be a built-in keyword to do this right. It's too easy to get this wrong and even worse possible problems only show up rarely.
In my view there should be a built-in keyword to do this right. It's too easy to get this wrong and even worse possible problems only show up rarely.
T SyncResult<T>(this Task<T> task){ return task.ConfigureAwait(false).Result; }
Same for ValueTask. It may already be implemented in the base .NET library as well.