Back to All

Extension > Making Asynchronous Calls

(edited)

Question

What's the best way to make async calls in the Extension?

Answer

When you have to call an async method, don't use Task.Result; instead, use this:

.ConfigureAwait(false).GetAwaiter().GetResult()

It looks terrible, but it's more reliable this way. Task.Result can lead to deadlocks.