backendgym backendgym · reps Sign in with GitHubSign in

04The deadlock that isn't there

csharp-reading / reps/04/README.md

FetchAsync().Result blocks on an async call, and every article about async in .NET says this deadlocks.

Read Program.cs first, then run it: dotnet run --project reps/04. It prints:

before
after: done

No deadlock, and no hang either.

After the rep
  1. 1 Why is this one fine? Name both reasons: what a console application does not have, and what FetchAsync does after its await.
  2. 2 In which kind of application would this code hang forever if it weren't for one detail it already contains? Name the application and the detail.