Found by: the issue #201 oracle sweep, docs/notes/oracle-sweep-2026-07-10.md; catalogued as docs/notes/field-notes-patterns.md entry 18.
The pattern
DropDownContent.Closed += DropDownContent_Closed; // <- flagged: no visible -= near the +=
void DropDownContent_Closed(object sender, EventArgs e) {
((Popup)sender).Closed -= DropDownContent_Closed; // removes itself, first firing
this.IsDropDownContentOpen = false;
}
The handler removes itself from the event the first time it runs — a common one-shot idiom ("do this once, then stop listening") that needs no external detach call. By the time the event could fire a second time, the subscription is already gone.
Own.NET's -= search is scoped to the subscribe call's enclosing method (or a class-level scan for a field-based handler); it doesn't look inside the handler's own body for a matching self-removal.
Evidence
- AvalonEdit
ICSharpCode.AvalonEdit/Search/DropDownButton.cs:78-86
Suggested direction (not prescriptive)
When resolving whether a subscribed handler has a matching -=, also check the handler method's own body for a -= against the same event/delegate expression (typically via the sender parameter cast back to the source type) — a handler that detaches itself is bounded by construction.
Scope
No analyzer code changed as part of the sweep — this issue tracks the fix as its own unit of work.
Found by: the issue #201 oracle sweep,
docs/notes/oracle-sweep-2026-07-10.md; catalogued asdocs/notes/field-notes-patterns.mdentry 18.The pattern
The handler removes itself from the event the first time it runs — a common one-shot idiom ("do this once, then stop listening") that needs no external detach call. By the time the event could fire a second time, the subscription is already gone.
Own.NET's
-=search is scoped to the subscribe call's enclosing method (or a class-level scan for a field-based handler); it doesn't look inside the handler's own body for a matching self-removal.Evidence
ICSharpCode.AvalonEdit/Search/DropDownButton.cs:78-86Suggested direction (not prescriptive)
When resolving whether a subscribed handler has a matching
-=, also check the handler method's own body for a-=against the same event/delegate expression (typically via thesenderparameter cast back to the source type) — a handler that detaches itself is bounded by construction.Scope
No analyzer code changed as part of the sweep — this issue tracks the fix as its own unit of work.