Pregunta

As far as I know, there isn't a synchronization context in a Windows Service application.

  • Does await fooTask.ConfigureAwait(false) give me any benefits in Windows Services?
  • Are there any pitfalls to this?
¿Fue útil?

Solución

Does await fooTask.ConfigureAwait(false) give me any benefits in Windows Services? Are there any pitfalls to this?

There is no pitfalls, for as long as there is no code which would install a synchronization context. There is no benefits either, for as long as this code runs on a thread without synchronization context.

Nevertheless, this code still would make sense for a shared class library, aimed to be used in different execution environments.

If you did have a synchronization context, there might be some pitfalls.

Updated: it's now 2021 and here's what I think about using ConfigureAwait these days.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top