WebView2 panels become permanently unavailable until restart (shared UDF + incompatible AdditionalBrowserArguments)
メンテナーはふだん 4 日以内に返信
評価
調査の方向性
Start with the listed WebView2 panel files and trace how each creates its environment and sets AdditionalBrowserArguments; compare the dark theme paths with HTML and Markdown viewers. Then inspect initialization and process failure handling, along with app startup cleanup after the single instance check. Done means shared panels use compatible environment settings and failures can recover without restarting QuickLook.
索引モデルが issue の本文から書いたものです。
説明
Summary / 摘要
All WebView2-based previews (HTML, Markdown, SVG, Font, CHM, etc.) can enter a sticky broken state where every webview panel stays blank until QuickLook is restarted.
所有基于 WebView2 的预览(HTML、Markdown、SVG、字体、CHM 等)可能进入粘滞故障状态:全部 webview 面板空白,只有重启 QuickLook 才能恢复。
Environment / 环境
- App: QuickLook (current main)
- Component:
Microsoft.Web.WebView2 - Shared user data folder: local data path →
WebView2_Data - Especially reproducible under dark theme
Symptoms / 现象
-
WebView2 previews work normally at first.
-
After switching among certain file types (notably Font / CHM / PlantUML while other HTML-based viewers are also used), all WebView2 previews become blank/unusable.
-
Non-WebView2 viewers may still work.
-
Restarting QuickLook restores WebView2 previews.
-
起初 WebView2 预览正常。
-
在若干类型间切换后(尤其是字体 / CHM / PlantUML,同时也会用到其它 HTML 类预览),所有 WebView2 预览变为空白/不可用。
-
非 WebView2 查看器可能仍可用。
-
重启 QuickLook 后 WebView2 恢复正常。
Root cause / 根因
1) One shared browser process for every WebView2 panel
Every panel uses the same UserDataFolder (WebView2_Data). WebView2 shares one browser process per user-data-folder within the host process. If that environment becomes invalid or the browser process dies, all webview panels fail together.
1) 所有 WebView2 面板共享同一个浏览器进程
所有面板共用同一 UserDataFolder(WebView2_Data)。同一宿主进程内,相同用户数据目录会共享一个浏览器进程。一旦该环境失效或浏览器进程退出,全部 webview 会一起挂掉。
2) Incompatible AdditionalBrowserArguments on the same UDF
Some viewers append browser arguments only in dark mode:
FontViewer/ChmViewer/PlantUml→--enable-features=WebContentsForceDarkHtmlViewer/MarkdownViewer/ most image web panels → no such argument
WebView2 requires environment configuration (including AdditionalBrowserArguments) to stay compatible for a given user data folder. Creating a new WebView2 with incompatible args against an already-running browser process fails, commonly with:
ERROR_INVALID_STATE/0x8007139F
2) 同一 UDF 上使用了不兼容的 AdditionalBrowserArguments
部分查看器仅在深色主题下追加浏览器参数(见上)。WebView2 要求同一用户数据目录的环境配置保持兼容;参数冲突时创建失败,常见 0x8007139F。
References / 参考:
- https://github.com/MicrosoftEdge/WebView2Feedback/issues/3389
- https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/process-related-events
3) No recovery path (amplifies a one-time failure into “restart required”)
Previously:
- No
CoreWebView2.ProcessFailedhandling CoreWebView2InitializationCompletedignored!e.IsSuccess- No cleanup of leftover
EBWebViewsingleton lock files after a crashed browser process
Therefore a single incompatible-create failure or browser-process crash left QuickLook unable to create any further WebView2 controls until process restart.
3) 没有恢复路径(把一次性失败放大成“必须重启”)
此前未处理 ProcessFailed、忽略初始化失败、也不清理崩溃后的 singleton 锁,因此一次失败就会粘滞到重启宿主进程为止。
Expected behavior / 期望行为
-
All WebView2 panels must use an identical environment configuration for the shared
WebView2_Datafolder. -
Browser-process crashes / init failures should be logged and recovered (dispose + recreate, clear stale singleton locks) without requiring a full app restart.
-
共用
WebView2_Data的所有 WebView2 面板必须使用完全一致的环境配置。 -
浏览器进程崩溃 / 初始化失败应记录日志并可自愈(销毁并重建、清理残留 singleton 锁),不应要求整应用重启。
Suggested fix direction / 修复方向
-
Centralize
CoreWebView2CreationProperties/ environment creation; never set per-viewerAdditionalBrowserArgumentson the shared UDF. -
Prefer
CoreWebView2Profile.PreferredColorSchemefor dark/light instead ofWebContentsForceDarkbrowser args. -
Handle
ProcessFailed(BrowserProcessExited/RenderProcessExited) and failed initialization with one retry after lock cleanup. -
On app startup (after single-instance check), delete stale
EBWebView\SingletonLock|SingletonCookie|SingletonSocketif present. -
集中创建环境;不要在共享 UDF 上按查看器设置不同的
AdditionalBrowserArguments。 -
深浅色改用
PreferredColorScheme,不要用WebContentsForceDark浏览器参数。 -
处理
ProcessFailed与初始化失败,清理锁后重试一次。 -
启动时(单实例检查之后)清理残留的 singleton 锁文件。
Related code / 相关代码
QuickLook.Plugin.HtmlViewer/WebpagePanel.csQuickLook.Plugin.HtmlViewer/Helper.csQuickLook.Plugin.FontViewer/WebfontPanel.csQuickLook.Plugin.ChmViewer/ChmWebpagePanel.csQuickLook.Plugin.ImageViewer/Webview/PlantUml/PuImagePanel.csQuickLook.Plugin.ImageViewer/Webview/Svg/SvgImagePanel.cs
Notes / 备注
This matches reports of blank Markdown/HTML previews that only recover after restart. The dark-theme ForceDark argument mismatch is a strong trigger; a browser-process crash without recovery produces the same sticky symptom.
这与“Markdown/HTML 预览空白、重启才恢复”的现象一致。深色主题下 ForceDark 参数不一致是强触发条件;浏览器进程崩溃且无恢复逻辑也会表现为同样的粘滞故障。
Possibly related: #2031
- 主要言語
- C#
- スター
- 25.7k
- フォーク
- 1.4k
- 平均マージ
- 4日 8分
- マージ済み PR(30日)
- 3
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
QL-Win/QuickLook のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
QL-Win/QuickLook#2028 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
[Bug] If the first character entered into the search box is a space, the preview window will close.対応中かも @MORTEM3845 が 14 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 4 日以内に返信
-
[Crash] Fatal CLR error (80131506) previewing any SVG when WebView2 controller creation fails — initialization failure is silently ignored対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
QL-Win/QuickLook#2056 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
QL-Win/QuickLook の issue をすべて見る
似ている issue
-
needs-triage
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
Azure/azure-sdk-for-net#64658 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/aspnetcore#70370 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NethermindEth/nethermind#15684 ·
メンテナーはふだん 1 日以内に返信
-
area/ai-assistant squad/flyt
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
Altinn/altinn-studio#21798 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
SubtitleEdit/subtitleedit#16699 ·
メンテナーはふだん 1 日以内に返信