Skip to content

Redundant Captured Context

Michael Damatov edited this page Jan 17, 2024 · 2 revisions

Analyzes whether adding .ConfigureAwait(false) is recommended.

Analyzer

Highlights the await keyword, if all following conditions are true:

  • the awaited expression is the last expression in the method (local functions declared at the end of the method do not count as last) or the awaited expression is returned by the return statement
  • ConfigureAwait(...) is not applied to the awaited expression

Applies to

  • methods
  • lambda expressions
  • anonymous methods
  • local functions

💡 A context action is always available to add the ConfigureAwait(false) expression.

💡 The analyzer can be deactivated in the ReSharper Options dialog.