Repository navigation
Commit 3648802
committed
fix(extractor): recognize
Scopes this PR to the uncontentious fix and addresses the review.
#1 `.Close()` releases a field — the field-disposable `disposed` scan credited a
field only on Dispose()/DisposeAsync(), but the LOCAL detector (DisposesLocal and
the flow detector) has always accepted Dispose/Close/DisposeAsync. That asymmetry
flagged a field cleaned up by Close() as a leak. Mirror the local set on both the
direct and null-conditional field-release checks. Mined: Npgsql ReplicationConnection
releases its NpgsqlConnection field via `await _npgsqlConnection.Close(async: true)`.
Receiver-scoped (Codex/CodeRabbit): credit only THIS instance's field or a validated
alias via ThisFieldName, so `other._conn.Close()` on ANOTHER instance of the SAME
class cannot mark this object's `_conn` released. (A field-symbol ContainingType
check would NOT catch this — same class, same ContainingType — so the receiver is
keyed syntactically; this also tightens the pre-existing Dispose path.)
Dropped: the SemaphoreSlim dispose-optional change. Putting SemaphoreSlim in the
shared IsDisposeOptional also affected the flow-locals detector and tripped the
deliberate `semLeak` control (a prior ShareX fix explicitly decided SemaphoreSlim
stays tracked for method-bounded locals, since reading AvailableWaitHandle allocates
a handle Dispose must release — Codex flagged the same). A sound, field-scoped +
AvailableWaitHandle-gated version is a separate decision, deferred.
Regression sample CloseReleaseSample.cs: ReleasesViaClose._closedConn / _closedConnQ
(direct + null-conditional Close) silent; controls still warn — LeaksUnclosed._leakedConn
(never closed) and ClosesOtherInstanceField._xconn (closed only on ANOTHER instance).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg8kSk1YT14x7A1vo5zgED.Close() as a field release (receiver-scoped); drop the SemaphoreSlim exemption1 parent d2f9599 commit 3648802
4 files changed
Lines changed: 74 additions & 90 deletions
File tree
- .github/workflows
- frontend/roslyn
- OwnSharp.Extractor
- samples
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
| 265 | + | |
275 | 266 | | |
276 | 267 | | |
277 | 268 | | |
278 | 269 | | |
279 | | - | |
280 | | - | |
| 270 | + | |
| 271 | + | |
281 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
282 | 278 | | |
283 | 279 | | |
284 | 280 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
| 472 | + | |
477 | 473 | | |
478 | 474 | | |
479 | 475 | | |
| |||
2264 | 2260 | | |
2265 | 2261 | | |
2266 | 2262 | | |
2267 | | - | |
2268 | | - | |
2269 | | - | |
2270 | | - | |
2271 | | - | |
2272 | | - | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
2273 | 2273 | | |
2274 | 2274 | | |
2275 | 2275 | | |
2276 | | - | |
| 2276 | + | |
2277 | 2277 | | |
2278 | 2278 | | |
2279 | 2279 | | |
| |||
2283 | 2283 | | |
2284 | 2284 | | |
2285 | 2285 | | |
2286 | | - | |
| 2286 | + | |
2287 | 2287 | | |
2288 | 2288 | | |
2289 | 2289 | | |
| |||
| 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 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
This file was deleted.
0 commit comments