[Problem/Bug]: WebView2 control throws OutOfMemoryException on call to EnsureCoreWebView2Async()
What happened?
Our WinUI 3 (WindowsAppSdk) app allows users to navigate to various pages to define a model, compute, and review tabular and graphic outputs. Some of these pages have WebView2 controls on them to show their content. Once we've loaded a WebView2 control 252 times, the 253rd attempt throws an OutOfMemory exception when we call EnsureCoreWebView2Async() when initializing the WebView2 control.
This was tested with the following configurations with the same behavior:
- Windows 10 (10.0.19045), WebView Runtime 125.0.2535.67 and 124.0.2478.109
- Windows 11 (10.0.22631), WebView Runtime 125.0.2535.67
Importance
Important. My app's user experience is significantly compromised.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
125.0.2535.67, 124.0.2478.109
SDK Version
1.0.2210.55
Framework
WinUI3/WinAppSDK
Operating System
Windows 10, Windows 11
OS Version
10.0.19045, 10.0.22631
Repro steps
- Run the attached application's Debug|x86 unpackaged configuration
- Click on a NavigationViewItem to load a page containing a single WebView2 control
- Continue clicking on a NavigationViewItem to load subsequent pages
- Once you start to load the 253rd page, it will crash with an OutOfMemory exception when the page calls the WebView2's EnsureCoreWebView2Async() method.
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
Don't know
Last working version (if regression)
No response
Is this the right repository for this issue? If not, I can open it in another one (WindowsAppSdk?) if that's a more appropriate place. Thank you!
Can I ask, if you have specific reasons to believe that this is something that is WebView2 related, instead of WindowsAppSdk? No worries if you don't, however.
Can I ask, if you have specific reasons to believe that this is something that is WebView2 related, instead of WindowsAppSdk? No worries if you don't, however.
Sorry, I don't really have any specific reason to think it's one or the other. I'm hoping it won't take too long for someone familiar with the code to be able to tell and point me in the right direction. Thanks again!
Thanks a lot for the repro. It is a WebView2 issue. We'll investigate and update.
Thanks a lot for the repro. It is a WebView2 issue. We'll investigate and update.
Have you had any luck tracking this down? Please let me know if there's anything else I can do to make it easier to investigate this issue. Thank you!
We are still investigating the issue. It is related to something in the OS itself and might take longer to address. The repro really helps and we have enough clue to investigate further.