Skip to content

Bug: qfc-item-controller-init-tests-flaky-window-handle #571

Description

@drmoisan
  • Work Mode: full-bug

Summary

Two tests in QuickFiler.Controllers.Tests.QfcItemController_InitializationTests
fail intermittently during a full-suite run with
InvalidOperationException: Invoke or BeginInvoke cannot be called on a control until the window handle has been created, but pass every time when the class is
run in isolation. The tests exercise a real WinForms Control.Invoke path with
no seam, so they depend on whether the control's window handle happens to exist
when the test reaches it.

Environment

  • OS/version: Windows 11 Pro 10.0.26200
  • Python version: n/a (C# / .NET Framework 4.8.1, MSTest)
  • Command/flags used: vstest.console.exe <9 test assemblies> /EnableCodeCoverage /InIsolation /Logger:trx /TestCaseFilter:"TestCategory!=LiveOutlook"
  • Data source or fixture: none; the failure is in test-host state, not data

Steps to Reproduce

  1. Build the solution in Debug.
  2. Run the full suite across all nine *.Test.dll assemblies with the command
    above.
  3. Repeat. The two tests below fail on some runs and pass on others.

Observed on 2026-08-15: run 1 passed both tests, run 2 failed both, run 3 (full
suite) passed both. Running only
/TestCaseFilter:"FullyQualifiedName~QfcItemController_InitializationTests"
passed 9 of 9 on every attempt.

Expected Behavior

Per .claude/rules/general-unit-test.md, tests are deterministic: identical
inputs and environment produce identical results, and the suite does not depend
on ordering or on ambient UI state.

Actual Behavior

Both of the following fail non-deterministically:

  • InitializeNineArgOverload_ThroughThePumpHost_SavesParametersAndDelegates
  • InitializeBool_ThroughThePumpHost_CompletesAndInitializesState
System.InvalidOperationException: Invoke or BeginInvoke cannot be called on a
control until the window handle has been created.
   at System.Windows.Forms.Control.MarshaledInvoke(...)
   at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
   at QuickFiler.ItemViewer.QuickFiler.IItemViewer.Invoke(Delegate method)
   at QuickFiler.Controllers.QfcItemController.InvokeBeginInvoke(Boolean async, Action action)
      in QuickFiler\Controllers\QfcItemController.FocusAndTheme.cs:line 256
   at QuickFiler.Controllers.QfcItemController.ToggleTips(Boolean async, ToggleState desiredState)
      in QuickFiler\Controllers\QfcItemController.FocusAndTheme.cs:line 204

Logs / Screenshots

  • Attached minimal logs or screenshot
  • Snippet: stack trace above, extracted from the TRX of the failing run on
    2026-08-15.

Impact / Severity

  • Blocker
  • High
  • Medium
  • Low

The failure is intermittent and does not indicate a production defect, but a
flaky test in a protected gate is corrosive: it trains reviewers to re-run
rather than investigate, and it can fail an otherwise-green CI run at random.

Source

From: docs/features/potential/2026-08-15-qfc-item-controller-init-tests-flaky-window-handle.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