Repository navigation
Commit b30db58
committed
fix(extractor): exempt process-host AppDomain event subscriptions from OWN014 (mined Npgsql)
Mining npgsql/npgsql surfaced this: PoolManager's static ctor subscribes
`AppDomain.CurrentDomain.{DomainUnload,ProcessExit} += (_,_) => ClearAll()` — a deliberate
"close idle connectors on appdomain unload (web-app redeployment)" hook (#491) — and the
detector reported it as an OWN014 region escape. But subscribing to a process-host AppDomain
event is never a leak: ProcessExit/DomainUnload run at shutdown, UnhandledException /
FirstChanceException on every unhandled throw, and the AppDomain IS the process host — the
handler is MEANT to live for the whole process. Promoting the subscriber to "the AppDomain's
lifetime" is the intent, not a leak.
IsProcessLifetimeAppDomainEvent exempts these four System.AppDomain events from the OWN014
region escape (alongside the self-owned-source and static-handler exemptions). Scoped to the
event's resolved declaring type, so a project's own `AppDomain`-named type is not matched, and a
non-AppDomain process-lived static event still escapes.
Regression sample AppDomainShutdownSample.cs: ShutdownCleanup (ProcessExit/DomainUnload/
UnhandledException lambdas) stays silent; NonAppDomainSubscriber (a lambda on a non-AppDomain
static event) still raises OWN014.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg8kSk1YT14x7A1vo5zgED1 parent 78c234b commit b30db58
3 files changed
Lines changed: 69 additions & 1 deletion
File tree
- .github/workflows
- frontend/roslyn
- OwnSharp.Extractor
- samples
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
| |||
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
320 | 330 | | |
321 | 331 | | |
322 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
206 | 219 | | |
207 | 220 | | |
208 | 221 | | |
| |||
2078 | 2091 | | |
2079 | 2092 | | |
2080 | 2093 | | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
2081 | 2098 | | |
2082 | | - | |
| 2099 | + | |
| 2100 | + | |
2083 | 2101 | | |
2084 | 2102 | | |
2085 | 2103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
0 commit comments