Skip to content

Bug: emailmovemonitor-rejected-item-hook-retention #426

Description

@drmoisan
  • Work Mode: full-bug

Summary

Mail items that the QuickFiler high-confidence dequeue gate scores and rejects are removed from the master queue but are never unhooked from EmailMoveMonitor. Each retained entry holds a live MailItem COM reference and participates in a Folder.BeforeItemMove subscription until session cleanup, so COM-reference retention grows in proportion to the number of rejected candidates.

Environment

  • OS/version: Windows 11 Pro 10.0.26200
  • Runtime: C# / .NET Framework 4.8.1 VSTO add-in (no Python involvement)
  • Command/flags used: QuickFiler launched from the TaskMaster ribbon with QfSettings.HighConfidenceModeEnabled = true
  • Data source or fixture: Live Outlook mailbox with a realistic message volume and a low fraction of items above HighConfidenceThreshold

Steps to Reproduce

  1. Enable High Confidence mode and launch QuickFiler against a folder where most messages score below the threshold.
  2. Let the dequeue gate scan and reject a large number of candidates while assembling the first batch.
  3. Inspect EmailMoveMonitor._hookedItems (or observe process COM-reference growth) while the QuickFiler session remains open.

Expected Behavior

An item removed from the master queue is unhooked from the move monitor regardless of whether the gate accepted or rejected it, so _hookedItems tracks only items still under management.

Actual Behavior

Only accepted items are unhooked. _hookedItems accumulates one EmailMoveAction per rejected candidate for the life of the session, each holding a live MailItem COM reference. If such a mail is moved while QuickFiler is open, the retained hook action fires _masterQueue.Remove(x) for an item no longer in the queue - a no-op removal, but evidence that the stale hook is still live.

Logs / Screenshots

Impact / Severity

  • Blocker
  • High
  • Medium
  • Low

Medium: no data loss or incorrect filing. The cost is session-scoped unmanaged-resource retention and a set of live event subscriptions that outlive their purpose. Everything is released at Cleanup(). Severity rises with the volume of rejected candidates, so the issue #424 fix - which makes high-confidence scanning practical and therefore more heavily used - increases exposure rather than reducing it.

Source

From: docs/features/potential/2026-08-07-emailmovemonitor-rejected-item-hook-retention.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions