ConfigureAwaitChecker with support for “await using” and “await foreach”
It’s probably bit overdue, but I finally implemented checking for ConfigureAwait(false)
in my ConfigureAwaitChecker for await using
and await foreach
. Why now? I simply (finally) needed it. So, what’s new?
It’s pretty straightforward. If you have an object implementing IAsyncDisposable
or IAsyncEnumerable<T>
and using await using
or await foreach
you can/should use ConfigureAwait(false)
in these, similarly to when using await
with Task
, ValueTask
, …
One remaining piece missing (tracked here) is properly extracting variable out of await using
when applying the code fix, because the datatype is different after adding ConfigureAwait(false)
and probably the insides of the using
block will not work. I originally blogged about it here. This will be in next update.
Also, with this release I’m releasing the ConfigureAwaitChecker library that the analyzer is using as a NuGet package. In case you’d like to build some awesome stuff on top of it.
Thus, update your ConfigureAwaitChecker.Analyzer or get ConfigureAwaitChecker.Lib and enjoy (or report any issues).