Commit 685fbf6
committed
fix(extractor): scope the AppDomain-event exemption to NON-CAPTURING handlers (Codex P1)
Codex: the first cut keyed only off the EVENT (the AppDomain source), ignoring the handler —
so it also dropped a real region escape, e.g. `AppDomain.CurrentDomain.ProcessExit += (_,_) =>
_field++` or an instance-method handler, whose delegate target is the subscriber and is pinned
to the process until shutdown. The Npgsql case is safe only because its lambda is non-capturing
(a static `ClearAll()` call).
HandlerRetainsNoInstance now gates the exemption: a static method group (null target) or a
lambda that captures neither `this` (explicit, or implicit via an instance member) nor an
enclosing local/parameter. A capturing handler stays OWN014.
Sample: ShutdownCleanup gains the 4th event (FirstChanceException, CodeRabbit) and a new
CapturingShutdownSubscriber (`(_,_) => _count++`) that must STILL warn. CI: assert no OWN014
anywhere in the sample file (format-insensitive, CodeRabbit) for the exempt cases, and OWN014
for both the non-AppDomain and the capturing controls.
(Rebased onto current main — #86/#87 landed; resolved the ci.yml sample-list conflict.)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg8kSk1YT14x7A1vo5zgED1 parent b30db58 commit 685fbf6
3 files changed
Lines changed: 77 additions & 13 deletions
File tree
- .github/workflows
- frontend/roslyn
- OwnSharp.Extractor
- samples
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
327 | 328 | | |
328 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
329 | 332 | | |
| 333 | + | |
| 334 | + | |
330 | 335 | | |
331 | 336 | | |
332 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
219 | 261 | | |
220 | 262 | | |
221 | 263 | | |
| |||
2092 | 2134 | | |
2093 | 2135 | | |
2094 | 2136 | | |
2095 | | - | |
2096 | | - | |
2097 | | - | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
2098 | 2142 | | |
2099 | 2143 | | |
2100 | | - | |
| 2144 | + | |
| 2145 | + | |
2101 | 2146 | | |
2102 | 2147 | | |
2103 | 2148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
24 | 38 | | |
25 | 39 | | |
26 | 40 | | |
| |||
0 commit comments