Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash Caused by Re-Entrancy Due to Call to m_coreWebViewController.IsVisible(...) #10305

Open
brianrob opened this issue Jan 16, 2025 · 0 comments
Labels
area-WebView bug Something isn't working needs-triage Issue needs to be triaged by the area owners team-Controls Issue for the Controls team

Comments

@brianrob
Copy link
Member

Describe the bug

When using WebView2 from XAML, there is an intermittent crash due to re-entrancy. This results when calling CoreWebView2Controller::IsVisible, which calls ShowWindow, which pumps messages.

Steps to reproduce the bug

I don't have a minimal repro, but can share the relevant part of the stack:

ntdll!KiUserCallbackDispatcherContinue

win32u!ZwUserShowWindow+0x14

EmbeddedBrowserWebView!embedded_browser_webview_current::Controller::SyncVisibility+0x64

EmbeddedBrowserWebView!embedded_browser_webview_current::Controller::put_IsVisible+0xb7

Microsoft_Web_WebView2_Core!winrt::Microsoft::Web::WebView2::Core::implementation::CoreWebView2Controller::IsVisible+0x57

Microsoft_Web_WebView2_Core!winrt::impl::produce<winrt::Microsoft::Web::WebView2::Core::implementation::CoreWebView2Controller,winrt::Microsoft::Web::WebView2::Core::ICoreWebView2Controller>::put_IsVisible+0x60

Microsoft_UI_Xaml_Controls!winrt::impl::consume_Microsoft_UI_Xaml_IUIElementOverrides<winrt::Microsoft::UI::Xaml::IUIElementOverrides>::OnDisconnectVisualChildren+0x14

Microsoft_UI_Xaml_Controls!WebView2::UpdateCoreWebViewVisibility::__l10::<lambda_2>::operator()+0x12

Microsoft_UI_Xaml_Controls!WebView2::CoreWebView2RunIgnoreInvalidStateSync<`WebView2::UpdateCoreWebViewVisibility'::`10'::<lambda_2> >+0x16

Microsoft_UI_Xaml_Controls!WebView2::UpdateCoreWebViewVisibility+0xed

Per @codendone, the fix here is to add a PauseNewDispatch around the call to m_coreWebViewController.IsVisible(...).

Expected behavior

The application should not crash.

Screenshots

No response

NuGet package version

None

Windows version

Windows 11 (23H2): Build 22631

Additional context

No response

@brianrob brianrob added the bug Something isn't working label Jan 16, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Jan 16, 2025
@codendone codendone added area-WebView team-Controls Issue for the Controls team labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-WebView bug Something isn't working needs-triage Issue needs to be triaged by the area owners team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

2 participants