libplctag / libplctag.NET

A .NET wrapper for libplctag.
https://libplctag.github.io/
Mozilla Public License 2.0
214 stars 53 forks source link

ConfigureAwait(false) Changes #351

Closed bwcurless closed 11 months ago

bwcurless commented 11 months ago

Changed all awaits to not run continuations on captured context to prevent deadlocks that occur when a tag is read or written from a UI context.

timyhac commented 11 months ago

Yeah nice - I agree with this design decision. Thanks for raising this!

For some reason I always thought that ConfigureAwait(false) kills the context stack, so if you did ConfigureAwait(false) at the low level (e.g. in a library), it would prevent the ability for a top-level async call from continuing on its context. I'm not sure why I thought this..

Given this change, I think it could be useful to add an analyzer to remind us in the future to adopt this choice.