microsoft / microsoft/microsoft-ui-xaml
WebView2 freezes when <body contenteditable="true">
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
Observing freeze in WinUI3 and UWP applications using WebView2 when the HTML is set as contenteditable='true'.
When the freeze occurs, the following entry is consistently logged in Event Viewer under Event ID 256 from source EdgeWebView:
> The description for Event ID 256 from source EdgeWebView cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
if the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
[43352:32900:0626/154917.901:INFO:chrome\browser\extensions\extension_garbage_collector.cc:184] Garbage collection for extensions on file thread is complete.
The message resource is present but the message was not found in the message table
A screen recording clearly demonstrating the freeze during interaction has been attached.
https://github.com/user-attachments/assets/b09e91ba-aa8e-4614-86db-9d7a6943ba14
The freeze is often reproducible when the system is set to Best power efficiency mode, with the charger unplugged. Content length doesn't have to be large - the issue still occurs with minimal content in the editable body.
The issue is rarely seen in Balanced or Best Performance battery modes - the better the performance, the less often it happens.
### Repro steps
**Setup (Required before launching the app):**
1. Change battery settings:
- Set battery mode to Best power efficiency
- Unplug the charger
2. Keep the device in the set power state for 15–20 minutes.
**Steps to reproduce:**
1. Create a WinUI3/UWP app
2. Add a WebView2 control from Microsoft.UI.Xaml and load an HTML page with `` - Content length doesn’t matter
3. Run the app and interact with WebView2 repeatedly:
- Select a few words or lines and press Ctrl + C / Ctrl + A
- Scroll down and then scroll back to the top
- Try typing in the editor
4. Observe: The app freezes temporarily - Keystrokes do not appear for a few seconds and UI becomes unresponsive
**Sample Project:**
You can also find the source code of a minimal UWP project to reproduce the issue here: [WebView2FreezePOC on GitHub](https://github.com/Aishwarya-Jeyaraj/WebView2FreezePOC/tree/main)
For convenience, sideloadable [.msixbundles](https://workdrive.zoho.com/folder/ve1rfdd5e45e522984b1ab13716475506cd2a) in different environments (WinUI3, UWP and .Net 9 UWP) are also provided to install and test without building the project. Follow the below steps to install the app,
1. Inside the ZIP, locate and install the provided security certificate:
- Right-click the .cer file and choose Install Certificate
- Select Local Machine
- Choose Place all certificates in the following store
- Browse and select Trusted People
2. After installing the certificate, run the .msixbundle to install the app.
### Framework
WinUI3, UWP and .NET 9 UWP
### NuGet Package Version
2.8.7
### WebView2 Runtime Version
137.0.3296.93
### Application Target OS Version
10.0.19041.0
### Application Minimum Target OS Version
10.0.18362.0
### Operating System
Windows 11 - 23H2 22631.5472
### Regression
Unable to reproduce the issue in Windows 10 - 22H2 190.45.5854
Contributor guide
Research direction
Start with the linked WebView2FreezePOC sample and reproduce the freeze using the stated WinUI3/UWP steps, battery mode, framework, package, and runtime versions. Investigate the interaction sequence involving an editable body, selection, scrolling, and typing; done means the temporary UI freeze is no longer reproducible under the reported conditions.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100