Skip to content

fix: analyze top-level CancellationTokenSource ownership#34

Merged
georgepwall1991 merged 1 commit into
masterfrom
fix/cc014-top-level-scope
Jul 21, 2026
Merged

fix: analyze top-level CancellationTokenSource ownership#34
georgepwall1991 merged 1 commit into
masterfrom
fix/cc014-top-level-scope

Conversation

@georgepwall1991

Copy link
Copy Markdown
Owner

Summary

  • treat the compilation unit as the synthesized function scope for top-level programs
  • diagnose undisposed top-level CancellationTokenSource locals
  • pin the existing using var code fix at top level
  • preserve nearer nested-function capture boundaries
  • prepare v1.27.179 release metadata

Why

CC014 registered top-level local declarations but abandoned them because no method-like ancestor existed. Console, worker, and minimal-host entry points could therefore leak CTS resources silently.

Validation

  • red-first analyzer regression reproduced the false negative
  • focused CC014 analyzer/code-fix tests: 16 passed
  • full suite: 635 passed, 0 failed
  • Release build: 0 errors (62 intentional sample analyzer warnings)
  • touched-file whitespace verification: clean
  • package inspection: both analyzer assemblies present; no NuGet dependencies
  • self-review completed as requested; no Claude review used

Tooling note

Slopwatch is required by the local .NET overlay but unavailable on this host (command not found). Manual hygiene and exact-diff review are clean.

Top-level locals belong to the synthesized program entry point. Treating the compilation unit as that scope lets CC014 detect undisposed sources and offer its existing safe using declaration fix.
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