문제

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?
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top