I have been using async
/await
for a while, but delved deeper recently, and read a lot of best practice tips saying to by default always use Confi
In general, this is true. When working in a Console or Service scenario, there is no SynchronizationContext
installed (by default) so the continueOnCapturedContext
option in ConfigureAwait
will have no effect, which means you can safely remove it without changing the runtime behavior.
However, there can be exceptions, so I would often suggest writing your code including ConfigureAwait(false)
when appropriate anyways.
The main advantages of including this even in a console or service application are:
SynchronizationContext
while running, the behavior of your methods won't change.