WebView2 panels become permanently unavailable until restart (shared UDF + incompatible AdditionalBrowserArguments)
Maintainer thường phản hồi trong vòng 4 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- C#
- Star
- 25.7k
- Fork
- 1.4k
- Merge trung bình
- 4 ngày 8 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của QL-Win/QuickLook
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
QL-Win/QuickLook#2028 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
[Bug] If the first character entered into the search box is a space, the preview window will close.Có thể đã có người làm @MORTEM3845 đã nhận 14 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 4 ngày
-
[Crash] Fatal CLR error (80131506) previewing any SVG when WebView2 controller creation fails — initialization failure is silently ignoredCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
QL-Win/QuickLook#2056 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của QL-Win/QuickLook
Issue tương tự
-
Incorrect loop bound in SizeOptIListSelectIterator.ToListCó thể đã có người làm @equmagg đã nhận hôm nay. Đang mởarea-System.Collections untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
dotnet/runtime#137126 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 76/100
Azure/azure-sdk-for-net#64658 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dotnet/aspnetcore#70370 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NethermindEth/nethermind#15684 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/ai-assistant squad/flyt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Altinn/altinn-studio#21798 ·
Maintainer thường phản hồi trong vòng 1 ngày