Blocking on a task ties up a thread while it waits, which defeats the point of async. Where there is a synchronisation context, as in classic ASP.NET or desktop UI apps, it can deadlock, because the blocked thread holds the context the continuation needs. In ASP.NET Core it usually causes thread pool starvation under load instead. It also wraps exceptions in an AggregateException. The fix is async all the way up.
Why interviewers ask this
Sync over async is one of the most common causes of production trouble in .NET services, and it often passes every test because it only fails under load or in a particular context. The interviewer wants the deadlock mechanism explained precisely, the different behaviour in ASP.NET Core, and the starvation risk. They also want a practical answer for code that cannot easily become async, such as a constructor or a legacy interface.
How to structure your answer
- Explain the classic deadlock with a synchronisation context.
- Explain why ASP.NET Core gets starvation instead.
- Mention the exception wrapping difference.
- Give the fix, and what to do when async all the way is not possible.
Example answer
There are two problems, and which one you get depends on where the code runs. In classic ASP.NET or a desktop app there is a synchronisation context that only one thread can be inside at a time. If I call Result on a task from that thread, I block it, and when the awaited operation finishes, its continuation tries to get back onto the same context, which is the thread I am blocking. Neither can proceed, so it deadlocks. ASP.NET Core has no synchronisation context, so that exact deadlock does not happen, but blocking still holds a thread pool thread for the whole wait. Under light load nobody notices. Under heavy load every request ties up a thread, the pool only adds new threads gradually, and latency climbs while CPU stays low. I have seen that take a service down during a traffic spike. Result also wraps failures in an AggregateException, which makes error handling messier. The fix is async all the way up. Where I genuinely cannot, like an old synchronous interface, I isolate it in one place and document why.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- How would you spot thread pool starvation in a running service?
- What would you do in a constructor that needs data from an async call?
- Is GetAwaiter().GetResult() any safer than Result?
Related .net developer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions