How-to-simply...

Write a regex to append ConfigureAwait(false) to ADO.NET commands

  • 1 Find what:
    (await conn\.OpenAsync\(\))(?=(\s|\n)*[^\.])
    (await cmd\.ExecuteReaderAsync\(\))(?=(\s|\n)*[^\.])
    (await rd\.ReadAsync\(\))(?=(\s|\n)*[^\.])
  • 2 Replace with:
    $1.ConfigureAwait(false)
  • N Prevent deadlocks when the library code is called with synchronous blocking, improves performance a bit.

References