79655627

Date: 2025-06-06 08:39:34
Score: 1.5
Natty:
Report link

After a year, I have realised that the issue does not actually exist — or more precisely, it does not concern ADO itself, but rather async/await.

A typical ADO call contains several constructs of this kind, especially when using a DataReader (OpenAsync, ExecuteReaderAsync, ReadAsync, etc.).

Well, all these await calls need to be followed by ConfigureAwait(false) — otherwise the application is forced to switch back and forth between threads, which ends up blocking everything.

That is really the whole point. In .NET, it was decided to adopt ConfigureAwait(true) as the default, probably to make it easier to adopt this powerful pattern. However, in doing so, the meaning and importance of ConfigureAwait remained somewhat in the background — and it took me a whole year to figure it out. :-)

Hopefully this can save someone else a bit of time!

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Marcello Poletti