Skip to content

Enforce ConfigureAwait(false) across shipped code#354

Merged
Vulthil merged 1 commit into
mainfrom
chore/configureawait-sweep
Jul 22, 2026
Merged

Enforce ConfigureAwait(false) across shipped code#354
Vulthil merged 1 commit into
mainfrom
chore/configureawait-sweep

Conversation

@Vulthil

@Vulthil Vulthil commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds src/.editorconfig enabling CA2007 as an error for every .cs file under src/ (tests/ and
    samples/ keep the repo-wide disabled default from the root .editorconfig).
  • Mechanically adds .ConfigureAwait(false) to every await in src/, then hand-fixes the spots
    the automatic fixer mangled (see Verification).
  • Adds one line to .github/copilot-instructions.md recording the policy.

NOTE: stacked on #353 — its base is the comment-policy-sweep branch so this diff is
the single ConfigureAwait commit. It gets retargeted to main after that PR merges.

Verification

  • Scoping proved empirically both ways: src/ builds fail on an unconfigured await; a test
    project with real unconfigured awaits raises zero CA2007 from any test file.
  • The formatter mis-handled every await using var x = expr.ConfigureAwait(false) where x's own
    members were used afterward, since wrapping the disposable changes its static type to
    ConfiguredAsyncDisposable. Hand-fixed ~15 locations by splitting into
    var x = expr; await using var _ = x.ConfigureAwait(false);, preserving both the real type and
    the configured disposal await. One ValueTask-coalescing expression surfaced new CA2012 +
    IDE0047 diagnostics under the transformation; rewritten properly rather than suppressed.
  • Full solution build, both TFMs: clean, 0 warnings/errors.
  • Full CI-parity suite (./eng/coverage.ps1), including the Aspire-hosted suite: 1582/1582
    passing on a clean run. An earlier run hit 4 failures under heavy parallel load; all 4 were
    independently confirmed as pre-existing timing-sensitive flakes unrelated to this change via
    isolated re-runs (each passed 100% standalone).
  • PublicAPI*.txt / CompatibilitySuppressions.xml: byte-identical (ConfigureAwait is
    implementation-only).
  • dotnet pack -c Release spot-run for two touched packages: both pack cleanly, no APICompat
    warnings.

Backport to v1.0: no — convention sweep ships with the next release.

Base automatically changed from chore/comment-policy-sweep to main July 22, 2026 18:32
@Vulthil
Vulthil force-pushed the chore/configureawait-sweep branch from f269c3f to c6d408c Compare July 22, 2026 18:33
@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@Vulthil
Vulthil merged commit 4444ef5 into main Jul 22, 2026
7 checks passed
@Vulthil
Vulthil deleted the chore/configureawait-sweep branch July 22, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant