A command line tool for ensuring ConfigureAwait() is specified for all await calls in a solution. Ideal for running in a CI pipeline.
- Run on existing codebases - existing 
awaits withoutConfigureAwait()will get a free pass on the first run of the tool. Only new/modified code on subsequent runs will flag an error, allowing you to add this to your pipeline now and fix existing code later - Supports 
dynamic- Enforces that whenawaitis called on somethingdynamic,ConfigureAwait()must still be present - Quickly fix invalid 
awaits - Prints the project name, file name, line number and code for each invalidawait - Integrates with CI pipelines - Uses a non-zero exit code when new invalid 
awaitis found, allowing you to fail the build 
> Slicedbread.ConfigureAwaitEnforcer.exe   MySolution.slnParsing command line args
Loading solution MySolution.sln
Analysing:
  MyProject - 91 documents
  AnotherProject - 53 documents
Found 3 new await call(s) without ConfigureAwait
  
  MyProject - SomeFile.cs
    54: await DoSomethingAsync();
    70: var a = DoSomethingElseAsync();
  
  MyProject - AnotherFile.cs
    12: await DoSomethingAsync();
> Slicedbread.ConfigureAwaitEnforcer.exe  MySolution.sln  -strictAll await calls without ConfigureAwait() will cause a failure and be written to the console, regardless of whether they were present in the codebase on the first run.
Useful if you wish to find all existing invalid awaits in your codebase locally.
> Slicedbread.ConfigureAwaitEnforcer.exe  MySolution.sln  /excludeFiles "tests"  /excludeFiles "fixture" Ignores any file with a name containing the string passed to /excludeFiles.
You can specify this multiple times.
This tool uses The .NET Compiler Platform (a.k.a. Roslyn).
Most of the repository is boilerplate for writing to the console etc. The interesting code, for parsing a document to find awaits without ConfigureAwait(), is in DocumentAnalyser.cs
The tests for this code (useful for checking what syntax the tool does/does not support) are here