Repository navigation
Bug: breadcrumb-webview2-init-fails-resource-not-in-correct-state #792
Description
Activity
Update 2026-09-06: reproduces on every Efc open via pop-out and Sort Email; severity raised to High
Two user-visible symptoms reported today are this failure:
- Pop-out from a QfcItem to an EfcItem shows an empty folder list. No suggestions, no banners, and typing a search string does nothing.
- Ribbon -> Sort Email opens an EfcViewer whose "Matched Folders:" section has no entries. The label is a static WinForms label above the breadcrumb WebView2, which is why it survives while the list is blank.
Log evidence
TaskMaster\bin\Debug\logs\debug_2026-09-06.logrecords the pairedWebView2BreadcrumbHost/EfcFormControllerinitialization failure with HRESULT 0x8007139F on every Efc open in the session: ten pop-out opens between 17:39:00 and 17:41:42, three at 19:04-19:06, and the Sort Email open at 19:56:36 (theSortEmail_Clickstack at 19:56:36,171 is followed by the failure at 19:56:37,940). Today the failure is deterministic on the Efc entry points, not intermittent as originally recorded.2026-09-06 19:56:37,940 [VSTA_Main] ERROR QuickFiler.Viewers.WebView2BreadcrumbHost - Breadcrumb CoreWebView2 initialization failed: The group or resource is not in the correct state to perform the requested operation. (Exception from HRESULT: 0x8007139F) 2026-09-06 19:56:38,004 [VSTA_Main] ERROR QuickFiler.Controllers.EfcFormController - Breadcrumb WebView2 initialization failed: The group or resource is not in the correct state to perform the requested operation. (Exception from HRESULT: 0x8007139F)Why the list is blank rather than degraded
BreadcrumbBridgeRouter.DeliverDocument(QuickFiler\Controllers\BreadcrumbBridgeRouter.Selection.cs:168-180) stashes the rendered document in_pendingDocumentwhen_host.IsCoreInitializedis false.WebView2BreadcrumbHost(:330-342) returns on!e.IsSuccesswithout ever raisingCoreInitialized, so the pending document is never navigated. There is no fallback rendering and no retry.EfcFormController.InitializeBreadcrumbHostAsync(:1071-1081) andPopulateFolderCombobox(:1250-1271) are fire-and-forget tasks with total catch blocks, so the failure is log-only.EfcFormController.BindBreadcrumbRowsAsync(:1115-1118) reads_globals.Ol.ArchiveRootPathunguarded;TryGetArchiveRoot(EfcDataModel.cs:280-297) is not used on the bind path.
Additional latent defect on the pop-out path
QfcCollectionController.PopOutControlGroup(QuickFiler\Controllers\QfcCollectionController.cs:710-735) hands only the rawMailItemand_globalstonew EfcHomeController(...)via the synchronous constructor, so the Efc view rebuilds prediction from scratch with an unloadedMailItemHelper(EfcDataModel.cs:48-81vsCreateAsync:89-142). The in-QuickFiler carry pattern from #678 (QfcItemController.FolderHandling.cs:68-83,_carriedFolderHandler) is not applied to the pop-out.EfcViewerQueue.BuildQueuehas no production call site, soEfcVieweris always constructed inline on the calling thread and capturesSynchronizationContext.Currentas-is (EfcViewer.cs:23-30); if the pop-out continuation lands off the UI thread,UiThread.SynchronizationContextAwaiterthrows on the null context (UiThread.cs:91-98) inside the same swallowed tasks.Additional acceptance criteria (settled with the maintainer 2026-09-06)
- AC-U1: A failed
CoreWebView2initialization is retried, and on final failure the Efc view shows a visible error state in the folder area instead of a blank list. - AC-U2:
_pendingDocumentis never silently dropped: it is delivered when initialization later succeeds or an error is surfaced. - AC-U3: The pop-out path carries the already-initialized folder predictor and loaded
MailItemHelperfrom the QfcItem, following the Bug: quickfiler-carry-folder-predictor-to-item-controller #678 carry pattern, and constructs theEfcVieweron the UI thread. - AC-U4:
PopulateFolderComboboxandInitializeBreadcrumbHostAsyncreport failures throughTryReportBoundaryFaultto the user, not log-only. - AC-U5: Manual verification on both entry points: pop-out from QuickFiler and ribbon Sort Email each show suggestion rows and respond to typed search.
Severity: raised from Medium to High. Both Efc entry points are unusable for folder selection in the affected sessions.
Diagnosis refreshed against current
main(2026-09-17) — defect still presentThe branch
bug/breadcrumb-webview2-init-fails-resource-not-in-correct-state-792has been merged up to currentmain(HEAD8d3ea6426, zero conflicts). All three mechanisms from the original diagnosis are intact. Nothing merged in the intervening fourteen items touched any part of the mechanism.1. The three WebView2 environment sites still diverge — STILL PRESENT
The user-data folder agrees across all three (
%LocalAppData%\WindowsFormsWebView2, the samePath.Combineexpression duplicated three times). The additional browser arguments do not.Site File:line Additional browser arguments EFC form breadcrumb QuickFiler/Viewers/WebView2BreadcrumbHost.cs:250none — default-constructed options QFC item viewer QuickFiler/Controllers/QfcItemController.ViewerSetup.cs:62"--incognito "— inline literalEfc pop-out item viewer QuickFiler/Controllers/EfcItemController.cs:188-190"--incognito "viaIncognitoArgumentat:177Same user-data folder plus differing
AdditionalBrowserArgumentsagainst a shared browser process is exactly the documented0x8007139Fcondition.New obstacle for AC-U6, not present when the spec was written.
EfcItemController.IncognitoArgumentnow exists at:177, and its XML doc at:168-176— plus a sibling comment atEfcItemController.WebViewFaultBoundary.cs:10-12— states it is deliberately not shared: "Named distinctly so no shared contract ... is implied." So AC-U6 must now reverse an explicit anti-contract and its documentation, not merely hoist a literal. No cross-site equality test exists; the only binding test isQuickFiler.Test/Controllers/EfcItemControllerTests.cs:372-378, which asserts the single EFC constant.Site 3 also still bypasses the
IWebViewCoreInitializerseam, callingCoreWebView2Environment.CreateAsyncdirectly at:195-199.2. The pending document is still silently discarded — STILL PRESENT, verbatim
_pendingDocumentlives in the router, not the host. Stashed atBreadcrumbBridgeRouter.Selection.cs:168-180whenIsCoreInitializedis false. The only drain isBreadcrumbBridgeRouter.cs:320-329(NotifyCoreInitialized), reachable from exactly one production wire-up atEfcFormController.cs:1064, which subscribes toCoreInitialized.That event is raised only on the success path. On failure,
WebView2BreadcrumbHost.cs:330-353:if (!e.IsSuccess) { log.Error($"Breadcrumb CoreWebView2 initialization failed: ...", e.InitializationException); return; // :341 — no event, no retry, no error document }
So the document is discarded, the outbound queue at
:328is never drained, and there is no retry anywhere:InitializeAsync(:239-270) is a single straight-line attempt with no loop and no re-entry trigger.3. Failure surfacing — SPLIT, and the defect half remains
PopulateFolderComboboxis correct.EfcFormController.cs:1268-1271callsTryReportBoundaryFaultat line 1270 — exactly where the original spec said it was. That half of AC-U4 is genuinely already satisfied.InitializeBreadcrumbHostAsyncis log-only.EfcFormController.cs:1072-1082, catch at:1080callslogger.Errorand nothing else, despiteTryReportBoundaryFaultbeing defined at:150-168in the same class and used by six other catch blocks (:556, :573, :591, :653, :668, :1015, :1127). Its caller at:1067is fire-and-forget, so nothing downstream observes it.
Partial progress since the diagnosis: the EFC item path is now guarded (
EfcItemController.cs:158plusEfcItemController.WebViewFaultBoundary.cs:25-42, from issue #726), so these tasks are caught rather than silently finalized. But that guard's sink defaults tologger.Errorwith no user-visible path, and its doc explicitly disclaims any contract withEfcFormController.BoundaryErrorSink. Nothing reaches the user on any WebView2 initialization path.Stale figures in the current spec, correct before re-planning
File Current Spec said EfcFormController.cs1181 1181 — still accurate EfcHomeController.cs386 447 — stale EfcItemController.cs998 — QfcCollectionController.cs2032 — WebView2BreadcrumbHost.cs328 — EfcHomeControllerhas since been partialed across six files, so the spec's "447 lines, roughly 53 of headroom" risk is obsolete — there is more room and a different structure.EfcFormController.cs(1181) andEfcItemController.cs(998) both exceed the 500-line ceiling before any change, which AC-U8 must account for.What static analysis could not establish
Recorded explicitly so it is not mistaken for evidence of a fix:
- Whether
0x8007139Factually fires at runtime. The argument divergence is the documented cause pattern and is demonstrably in the source; whether the Evergreen runtime rejects this pairing in this process, and which site loses, needs a live session. - Which site wins the shared browser process depends on runtime ordering between the three, which is not statically resolvable.
- Whether the empty folder list has any additional cause beyond the pending-document drop.
- Whether the Designer-set
CoreWebView2CreationProperties(ItemViewer.Designer.cs:195,241and three siblings, allnull) are truly inert given an explicit environment is passed toEnsureCoreWebView2Async. SDK precedence for that combination was not verified.
Sections 1 and 2 are demonstrably present in the code — the quoted lines are the defect, unmodified. Items 1-4 above are could not confirm from reading, which is a different finding and does not support closing.
Disposition: remains open. Diagnosis confirmed, plan to be regenerated against current
main.Delivered by PR #910, merged as
734112ed25bba293cb074e71fee2286bc3b72fae93 of 93 plan tasks, 9 of 9 acceptance criteria. Single clean toolchain pass: format rewrote nothing in the write set; analyzer and nullable rebuilds both 0 errors / 0 warnings with 36
cscinvocations and zero skippedCoreCompile; 1468/1468 tests; 452/452 on theTaskMaster.Testsweep. Coverage moved up: QuickFiler package 81.73 → 82.01% line, 78.04 → 78.24% branch, rolled up from class elements rather than trusting the Cobertura attribute.Root cause — a regression from #463, not present in the original diagnosis
The additional-browser-arguments literal opened with a U+2013 en dash rather than two ASCII hyphens, so it was never a recognised Chromium switch and no site effectively passed one. When #463 corrected the dash to ASCII on 2026-08-27 the argument became real, and two of the three WebView2 environment sites began passing it while the breadcrumb host continued passing none. Same user-data folder, differing
AdditionalBrowserArguments, shared browser process — the documented0x8007139Fcondition.The fix
Converges all three sites on one shared owner (
WebView2EnvironmentContract); routes the Efc item site through the mockable initializer seam it had been bypassing; retries a failedCoreWebView2initialization; surfaces final failure as a visible error state instead of dropping it; and drains the pending document and outbound queue on the failure path rather than only on the success path.Convergence direction settled on evidence, not on the regression history
An audit of the three files that generate the breadcrumb document found zero use of any browser storage API — no
localStorage,sessionStorage,indexedDB,document.cookie,navigator.storage,caches.oropenDatabase— and no external resource reference. The spec records explicitly that the #463 history is a separate and independent reason against the alternative direction, and is not what closes the storage question.AC-U5 — discharged by live manual verification, 2026-09-17
Against a session running the rebuilt add-in, confirmed by registry manifest resolution to the item-worktree build. All four required observations held:
- Suggestion rows on the QuickFiler pop-out entry point, not a blank list — maintainer-confirmed
- Rows responding to typed search — maintainer-confirmed
- Suggestion rows under "Matched Folders:" on the ribbon Sort Email entry point — maintainer-confirmed
- Zero occurrences of
Breadcrumb CoreWebView2 initialization failedor0x8007139Fin the session log — instrument-verified with positive controls
The log check was the discriminating observation. Because the fix adds retry, a session could have looked entirely correct to an observer while initialization was still failing and silently recovering. A clean log distinguishes a genuine convergence from a retry masking a conflict that still occurs.
One finding for separate triage
A structural-parity gate searching for the literal text
new CoreWebView2EnvironmentOptionsmatches a commented-out dead line atQfcItemController.ViewerSetup.cs:61while missing the live target-typed construction at:62, and would therefore pass on an unfixed tree. Any such gate must enumerate by type name, exclude comment text, and be observed failing before it is trusted.Closing manually —
closingIssuesReferenceswas empty by design.
Summary
The breadcrumb
CoreWebView2initialization fails intermittently with HRESULT 0x8007139F ("The group or resource is not in the correct state to perform the requested operation"), logged by bothWebView2BreadcrumbHostandEfcFormController. The failure is logged and swallowed; the session continues with a breadcrumb host that never initialized, and a laterBreadcrumbUiDispatcherdispatch fails in the same session. Because the #677 keyboard-lock mechanism is WebView2 focus retention, a half-initialized WebView2 is a plausible contributor to the sporadic keyboard lock, but that link is unconfirmed.Environment
TaskMaster\bin\Debugbuilt 2026-09-06 08:51 from7c8ac9aeSteps to Reproduce
TaskMaster\bin\Debug\logs\debug_<date>.logforBreadcrumb CoreWebView2 initialization failed.Not reproducible on demand.
Expected Behavior
WebView2 initialization either succeeds, or fails with a clear surfaced error and a defined fallback state that cannot retain keyboard focus. A failed initialization should be retried or the host disposed, not left half-constructed.
Actual Behavior
Two ERROR lines per occurrence (
WebView2BreadcrumbHost - Breadcrumb CoreWebView2 initialization failed: ... (HRESULT: 0x8007139F)andEfcFormController - Breadcrumb WebView2 initialization failed: ...), then normal operation continues. ABreadcrumbUiDispatcher - Breadcrumb UI dispatch failed.error followed at 09:01:56 in the same session.Logs / Screenshots
debug_2026-09-06.log):Impact / Severity
Medium: the breadcrumb folder selector is unavailable on affected launches, and the half-initialized control is a candidate contributor to the sporadic Outlook keyboard lock tracked under the sibling QuickFiler Cancel-teardown issue filed the same day.
Source
From: docs/features/potential/2026-09-06-breadcrumb-webview2-init-fails-resource-not-in-correct-state.md