andrewiggins / DeadlockAspNetTest

Sandbox to demonstrate various situations in which WPF & ASP.Net MVC 5 (not Core) may deadlock with async/await patterns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DeadlockAspNetTest

Sandbox to demonstrate various situations in which WPF & ASP.Net MVC 5 (not Core) may deadlock with async/await patterns

Brief Summary

Use async/await

Using GetAwaiter().GetResult() could result if deadlocks if the synchronization context that is synchronously waiting for the result is also the synchronization context that has to run the continuation of the async API call.

Using ConfigureAwait(false) can prevent the deadlock as it allows continuations to run on the default synchronization context, but may cause problems if the continuation callback references something the synchronization context (e.g. HttpContext.Current) syncrhonizes

Useful links

About

Sandbox to demonstrate various situations in which WPF & ASP.Net MVC 5 (not Core) may deadlock with async/await patterns

License:MIT License


Languages

Language:C# 72.8%Language:HTML 26.8%Language:ASP.NET 0.5%