WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

[Problem/Bug]: WebView2 control throws OutOfMemoryException on call to EnsureCoreWebView2Async()

Open tflopez opened this issue 1 year ago • 6 comments

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.

WebViewTest.zip

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

AB#51806338

tflopez avatar May 30 '24 21:05 tflopez

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!

tflopez avatar Jun 13 '24 14:06 tflopez

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.

victorhuangwq avatar Jun 13 '24 23:06 victorhuangwq

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!

tflopez avatar Jun 14 '24 00:06 tflopez

Thanks a lot for the repro. It is a WebView2 issue. We'll investigate and update.

LiangTheDev avatar Jun 14 '24 17:06 LiangTheDev

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!

tflopez avatar Jul 05 '24 14:07 tflopez

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.

LiangTheDev avatar Jul 05 '24 16:07 LiangTheDev