WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

WebView does not display the content in ~5% of runs

Open DmitryKorepanov opened this issue 4 years ago • 3 comments

Description Hi! I use Fixed Version WebView in Win32 application. It usually works fine. But in ~5% of application runs, the WebView does not display the content. Usually, 8 msedgewebview2.exe processes are created on the system to service WebView control. But in those 5% of cases when the WebView content is not displayed, there are only 4 or 5 processes. Crashpad\reports is empty. Event Log is empty. ProcessFailed event does not happen.

What could be the problem? Are there any tools for debugging?

Usage sample:

	auto options = Make<CoreWebView2EnvironmentOptions>();
	checkHRESULT( options->put_AdditionalBrowserArguments( L"--disable-features=msSmartScreenProtection" ) );
	checkHRESULT( CreateCoreWebView2EnvironmentWithOptions( runtimePath, userDataPath, options.Get(),
		Callback<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>( this, &CWebView::OnCreateEnvironmentCompleted ).Get() ) );

	// Pseudo-synchronous creation https://github.com/MicrosoftEdge/WebView2Feedback/issues/740
	while( webviewWindow == nullptr && ::WaitMessage() ) {
		CMessageLoop::PumpMessages( 0, WM_USER + 1, WM_USER + 1 );
	}

	checkHRESULT( webviewWindow->add_ProcessFailed(
		Callback<ICoreWebView2ProcessFailedEventHandler>( this, &CWebView::OnProcessFailed ).Get(), &processFailedToken ) );

	CComPtr<ICoreWebView2Settings> settings;
	checkHRESULT( webviewWindow->get_Settings( &settings ) );
	checkHRESULT( settings->put_IsZoomControlEnabled( FALSE ) );
	checkHRESULT( settings->put_IsStatusBarEnabled( FALSE ) );
	checkHRESULT( settings->put_AreDefaultContextMenusEnabled( FALSE ) );
	checkHRESULT( settings->put_AreDevToolsEnabled( FALSE ) );

	checkHRESULT( controller->put_Bounds( rect ) );

	checkHRESULT( webviewWindow->Navigate( url ) );

Version SDK: 1.0.1020.30 Runtime: 95.0.1020.53 Framework: Win32 OS: Win10

AB#37316750

DmitryKorepanov avatar Nov 30 '21 10:11 DmitryKorepanov

Hey @DmitryKorepanov - the biggest thing that jumps out is the message pump to try and achieve synchronous initialization. In the cases where nothing shows up, can you confirm that it gets past the message pump?

champnic avatar Dec 01 '21 17:12 champnic

Yes, the execution goes through message pump loop and application does not freeze. Webview looks as if it was forgotten to show.

DmitryKorepanov avatar Dec 07 '21 12:12 DmitryKorepanov

I've added this as a bug on our backlog. Thanks!

champnic avatar Dec 07 '21 21:12 champnic