Skip to content

[Problem/Bug]: Access violation after rapid resize #5246

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

Open
Tech5G5G opened this issue May 18, 2025 · 2 comments
Open

[Problem/Bug]: Access violation after rapid resize #5246

Tech5G5G opened this issue May 18, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Tech5G5G
Copy link

What happened?

I am attempting to implement a HWND-based WebView2 in the WinAppSDK using a CoreWebView2Controller. I am currently doing this by creating a Win32 window and setting the parent window of the CoreWebView2Controller to it. Using the FrameworkElement.SizeChanged event, I am able to update the CoreWebView2Controller bounds.

However, if I rapidly resize the CoreWebView2Controller for a couple of seconds and then attempt to access another website from the currently loaded site (e.g. Gmail -> YouTube), I sometimes get the following exception:
Unhandled exception at 0x00007FFC76571D35 (ntdll.dll) in Email Inboxes.dmp: 0xC0000005: Access violation writing location 0x000001B3DEF6D0B0.
with HRESULT
0x80004003 (E_POINTER)
which is accompanied by the following call stack:

ntdll.dll!RtlAcquireSRWLockExclusive()	Unknown
Microsoft.Web.WebView2.Core.dll!00007ffbfa5dd350()	Unknown
Microsoft.Web.WebView2.Core.dll!00007ffbfa631d4d()	Unknown
EmbeddedBrowserWebView.dll!EventSource<ICoreWebView2NavigationCompletedEventHandler>::InvokeAll<embedded_browser_webview_current::EmbeddedBrowserWebView,embedded_browser_webview_current::internal::NavigationCompletedEventArgs *>()	Unknown
EmbeddedBrowserWebView.dll!embedded_browser_webview_current::EmbeddedBrowserWebView::FireNavigationCompleted(bool,enum embedded_browser_webview::WebView2WebErrorStatus,unsigned __int64,int)	Unknown
EmbeddedBrowserWebView.dll!embedded_browser_webview::EmbeddedBrowserWebViewCore::OnNavigationCompleted(bool,int,unsigned __int64,int)	Unknown
EmbeddedBrowserWebView.dll!embedded_browser::mojom::EmbeddedBrowserClientStubDispatch::Accept(class embedded_browser::mojom::EmbeddedBrowserClient *,class mojo::Message *)	Unknown
EmbeddedBrowserWebView.dll!mojo::InterfaceEndpointClient::HandleIncomingMessageThunk::Accept(class mojo::Message *)	Unknown
EmbeddedBrowserWebView.dll!mojo::MessageDispatcher::Accept(class mojo::Message *)	Unknown
EmbeddedBrowserWebView.dll!mojo::InterfaceEndpointClient::HandleIncomingMessage(class mojo::Message *)	Unknown
EmbeddedBrowserWebView.dll!mojo::internal::MultiplexRouter::Accept(class mojo::Message *)	Unknown
EmbeddedBrowserWebView.dll!mojo::MessageDispatcher::Accept(class mojo::Message *)	Unknown
EmbeddedBrowserWebView.dll!mojo::Connector::ReadAllAvailableMessages()	Unknown
EmbeddedBrowserWebView.dll!base::TaskAnnotator::RunTaskImpl(struct base::PendingTask &)	Unknown
EmbeddedBrowserWebView.dll!base::TaskAnnotator::RunTask<>()	Unknown
EmbeddedBrowserWebView.dll!embedded_browser_webview::internal::AppTaskRunner::DoWork(void)	Unknown
EmbeddedBrowserWebView.dll!embedded_browser_webview::internal::AppTaskRunner::MessageCallback()	Unknown
EmbeddedBrowserWebView.dll!base::RepeatingCallback<bool (unsigned int, unsigned long long, long long, long long *)>::Run()	Unknown
EmbeddedBrowserWebView.dll!base::win::MessageWindow::WindowProc()	Unknown
EmbeddedBrowserWebView.dll!base::win::WrappedWindowProc<&base::win::MessageWindow::WindowProc>()	Unknown
user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,__int64 (*)(struct tagWND *,unsigned int,unsigned __int64,__int64),struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,void *,int)	Unknown
user32.dll!DispatchClientMessage()	Unknown
user32.dll!__fnDWORD()	Unknown
ntdll.dll!KiUserCallbackDispatcherContinue()	Unknown
win32u.dll!00007ffc73651344()	Unknown
user32.dll!RealDefWindowProcWorker()	Unknown
user32.dll!RealDefWindowProcW(struct HWND__ *,unsigned int,unsigned __int64,__int64)	Unknown
uxtheme.dll!00007ffc7084da8d()	Unknown
uxtheme.dll!00007ffc70886e1a()	Unknown
uxtheme.dll!00007ffc7084f8df()	Unknown
uxtheme.dll!00007ffc7084f171()	Unknown
user32.dll!DefWindowProcW()	Unknown
Microsoft.UI.Xaml.dll!00007ffba2aa52e8()	Unknown
Microsoft.UI.Xaml.dll!00007ffba2c727a5()	Unknown
user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,__int64 (*)(struct tagWND *,unsigned int,unsigned __int64,__int64),struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,void *,int)	Unknown
user32.dll!CallWindowProcW()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173cdea3()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173cbef4()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173b697d()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173b842f()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173ccd28()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173cd1fb()	Unknown
user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,__int64 (*)(struct tagWND *,unsigned int,unsigned __int64,__int64),struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,void *,int)	Unknown
user32.dll!DispatchClientMessage()	Unknown
user32.dll!__fnDWORD()	Unknown
ntdll.dll!KiUserCallbackDispatcherContinue()	Unknown
win32u.dll!00007ffc73651344()	Unknown
user32.dll!RealDefWindowProcWorker()	Unknown
user32.dll!RealDefWindowProcW(struct HWND__ *,unsigned int,unsigned __int64,__int64)	Unknown
uxtheme.dll!00007ffc7084da8d()	Unknown
uxtheme.dll!00007ffc708890b9()	Unknown
uxtheme.dll!00007ffc7084f8df()	Unknown
uxtheme.dll!00007ffc7084f171()	Unknown
user32.dll!DefWindowProcW()	Unknown
Microsoft.UI.Xaml.dll!00007ffba2aa52e8()	Unknown
Microsoft.UI.Xaml.dll!00007ffba2c727a5()	Unknown
user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,__int64 (*)(struct tagWND *,unsigned int,unsigned __int64,__int64),struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,void *,int)	Unknown
user32.dll!CallWindowProcW()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173cdea3()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173cbef4()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173b697d()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173b842f()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173ccd28()	Unknown
Microsoft.UI.Windowing.Core.dll!00007ffc173cd1fb()	Unknown
user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,__int64 (*)(struct tagWND *,unsigned int,unsigned __int64,__int64),struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,void *,int)	Unknown
user32.dll!DispatchMessageWorker()	Unknown
Microsoft.UI.Xaml.dll!00007ffba2c649cf()	Unknown
Microsoft.UI.Xaml.dll!00007ffba2c64902()	Unknown
Microsoft.UI.Xaml.dll!00007ffba2c646ef()	Unknown
[Managed to Native Transition]	
Microsoft.WinUI.dll!ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start(WinRT.IObjectReference _obj, Microsoft.UI.Xaml.ApplicationInitializationCallback callback)	Unknown
Microsoft.WinUI.dll!Microsoft.UI.Xaml.Application.Start(Microsoft.UI.Xaml.ApplicationInitializationCallback callback)	Unknown
Email Inboxes.dll!Email_Inboxes.Program.Main(string[] args)	Unknown
[Native to Managed Transition]	
hostpolicy.dll!00007ffc1d7726ac()	Unknown
hostpolicy.dll!00007ffc1d77297c()	Unknown
hostpolicy.dll!00007ffc1d77328a()	Unknown
hostfxr.dll!00007ffc271cd9a6()	Unknown
hostfxr.dll!00007ffc271cff26()	Unknown
hostfxr.dll!00007ffc271d200c()	Unknown
hostfxr.dll!00007ffc271d04f3()	Unknown
hostfxr.dll!00007ffc271c8350()	Unknown
Email Inboxes.exe!00007ff66bb1f888()	Unknown
Email Inboxes.exe!00007ff66bb1fc96()	Unknown
Email Inboxes.exe!00007ff66bb211b8()	Unknown
kernel32.dll!00007ffc7559e8d7()	Unknown
ntdll.dll!RtlUserThreadStart()	Unknown

Unfortunately, I am unable to find the symbols for Microsoft.Web.WebView2.Core.dll, so I can't fully understand what is happening during the last three calls of the stack, leaving me unable to further debug this issue.

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

136.0.3240.76

SDK Version

1.0.3240.44

Framework

WinUI3/WinAppSDK

Operating System

Windows 11

OS Version

26200.5600

Repro steps

Steps to repro:

  1. Rapidly resize a CoreWebView2Controller for a couple of seconds
  2. Attempt to access another website from the currently loaded site (e.g. Gmail -> YouTube)

Excepted:
Normal navigation from first to second site

Actual:
Exception is thrown with HRESULT 0x80004003 (E_POINTER)

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

@Tech5G5G Tech5G5G added the bug Something isn't working label May 18, 2025
@sivMSFT sivMSFT assigned venky8951 and Badhri and unassigned venky8951 May 19, 2025
@sivMSFT
Copy link

sivMSFT commented May 19, 2025

@Tech5G5G, could help with below mentioned questions?

  1. Are you using CoreWebView2Controller.Close() or disposing the controller during resize or navigation?
  2. Are you using any custom threading or background tasks that interact with the WebView2 controller?
  3. Does the crash happen only when navigating to specific sites (e.g., YouTube), or is it consistent across all?
  4. Are you using any event handlers like NavigationStarting, NavigationCompleted, or ContentLoading that might be modifying the controller?

@Tech5G5G
Copy link
Author

Thank you for your quick response!

Are you using CoreWebView2Controller.Close() or disposing the controller during resize or navigation?

No, I only dispose the controller once the application closes.

Are you using any custom threading or background tasks that interact with the WebView2 controller?

No, I only interact with the WebView2 controller on the main thread.

Does the crash happen only when navigating to specific sites (e.g., YouTube), or is it consistent across all?

The crash can occur on all pages, although inconsistently.

Are you using any event handlers like NavigationStarting, NavigationCompleted, or ContentLoading that might be modifying the controller?

No.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants