MicrosoftEdge/WebView2Feedback

Call to EnsureCoreWebView2Async very slow (~9 seconds)

simon-baer opened this issue · 3 comments

I included WebView2 in a rather complex WPF application and noticed that the call to EnsureCoreWebView2Async is very slow and takes about 9 seconds. I then put the same code into a simple new WPF application that only displays the WebView2 control and the call to EnsureCoreWebView2Async now only takes 350ms.
How is this possible? Are there ways find out what takes so long in EnsureCoreWebView2Async in this special case? How can the performance be improved?

SDK: 1.0.1462.37
Framework: .NET Framework 4.8
OS: Windows 10

Hi Simon! Can you get an ETW trace following the directions here - https://github.com/MicrosoftEdge/WebView2Feedback/blob/main/diagnostics/etw.md

Hi Andy
Unfortunately the wpr stop command failes with error 0x80010106, so I cannot complete the trace.
But something else come to my mind: Is it possible that the EnsureCoreWebView2Async method does not complete until the WebView2 control is actually visible?

EnsureCoreWebView2Async does not complete until the control is in the UI tree, so that it has a parent hwnd for the core WebView2 control. The control does not have to be visible, but has to be in the UI tree.