Skip to content

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

Open
@Tech5G5G

Description

@Tech5G5G

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions