Found by: the issue #201 oracle sweep, docs/notes/oracle-sweep-2026-07-10.md; catalogued as docs/notes/field-notes-patterns.md entry 17.
The pattern
EventHandler requerySuggestedHandler; // we need to keep the event handler instance
// alive because CommandManager.RequerySuggested
// uses weak references
requerySuggestedHandler = OnRequerySuggested;
CommandManager.RequerySuggested += requerySuggestedHandler; // never -=, and that's fine
System.Windows.Input.CommandManager.RequerySuggested is WPF's own answer to the classic "static event pins every subscriber forever" trap — it's implemented internally over weak references, so a subscriber is not kept alive by the subscription. The in-repo comment even explains the field exists to keep the handler from being collected prematurely — the opposite of the leak concern. Never unsubscribing is the normal, intended usage.
Own.NET tiers a subscription to a provably static source as a hard error ("its source is a static (process-lived) event source") — the systematically wrong verdict for this one named event.
Evidence
- AvalonEdit
ICSharpCode.AvalonEdit/Editing/ImeSupport.cs:34-47
Suggested direction (not prescriptive)
Add a small named allowlist (starting with System.Windows.Input.CommandManager.RequerySuggested) of BCL/WPF static events known to be implemented over weak references, exempted from the static-source hard-error tier. Extend the list only when another confirmed sibling is found — not a general "static sources are fine" relaxation.
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 17.The pattern
System.Windows.Input.CommandManager.RequerySuggestedis WPF's own answer to the classic "static event pins every subscriber forever" trap — it's implemented internally over weak references, so a subscriber is not kept alive by the subscription. The in-repo comment even explains the field exists to keep the handler from being collected prematurely — the opposite of the leak concern. Never unsubscribing is the normal, intended usage.Own.NET tiers a subscription to a provably
staticsource as a hard error ("its source is a static (process-lived) event source") — the systematically wrong verdict for this one named event.Evidence
ICSharpCode.AvalonEdit/Editing/ImeSupport.cs:34-47Suggested direction (not prescriptive)
Add a small named allowlist (starting with
System.Windows.Input.CommandManager.RequerySuggested) of BCL/WPF static events known to be implemented over weak references, exempted from the static-source hard-error tier. Extend the list only when another confirmed sibling is found — not a general "static sources are fine" relaxation.Scope
No analyzer code changed as part of the sweep — this issue tracks the fix as its own unit of work.