MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
451 stars 55 forks source link

[Problem/Bug]: Webview fails to initialize when uiaccess="true" as of Windows 10 update KB5044273 #4880

Open CanBanDan opened 6 days ago

CanBanDan commented 6 days ago

What happened?

As of our Windows 10 security patch KB5044273 the WebView2 browser integration in our application fails to initialization. This only affects Windows 10 devices and is a direct result of having UIAccess enabled and having the application run in program files.

We see a variety of similar exceptions but all involve a failure of EnsureCoreWebView2Async ERROR [2024-10-23 16:21:41.849] System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (The requested resource is in use. (0x800700AA)) ---> System.Runtime.InteropServices.COMException (0x800700AA): The requested resource is in use. (0x800700AA) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) at Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateCoreWebView2ControllerAsync(IntPtr ParentWindow) at Microsoft.Web.WebView2.Wpf.WebView2.<>c__DisplayClass33_0.<<EnsureCoreWebView2Async>g__Init|0>d.MoveNext() --- End of stack trace from previous location --- at SensorySoftware.Grids.Grid3.Modules.PlugIns.OfflineWebBrowser.OfflineWebBrowserControl.InitializeBrowserAsync() --- End of inner exception stack trace ---

We understand that this problem was caused upstream but due to the severity of the issue for our application we wanted to reach out and ask if anything can be done within WebView2. We also wished to inform others of the problem.

We currently have three options, none of which are desirable

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime), Prerelease (Edge Canary/Dev/Beta)

Runtime Version

130.0.2849.52

SDK Version

1.0.2210.55, 1.0.2895-prerelease

Framework

WPF

Operating System

Windows 10

OS Version

10.0.19045

Repro steps

You can skip steps 1 & 2 by cloning my fork of the samples repo and checking out the ui-access-breaks-init branch

Must be on Windows 10 and have KB5044273 installed

  1. Clone the WebView2 samples repo
  2. Add an application manifest that enables UI access.
  3. Build in Release Stable APIs configuration
  4. Code sign the resulting exe (I choose the .NET 6 build but any will do)
  5. Try to run the application. It will start just fine.
  6. Copy the application files into program files.
  7. Try to run. Webview2 will fail to initialize

Here is the stack trace seen for the sample app which is essentially the same as for our application `---------------------------


WebView2 creation failed with exception = System.Runtime.InteropServices.COMException (0x800700AA): The requested resource is in use. (0x800700AA)

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)

at Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateCoreWebView2ControllerAsync(IntPtr ParentWindow)

at Microsoft.Web.WebView2.Wpf.WebView2.Microsoft.Web.WebView2.Wpf.IWebView2Private.InitializeController(IntPtr parent_window, CoreWebView2ControllerOptions controllerOptions)

at Microsoft.Web.WebView2.Wpf.WebView2Base.<>c__DisplayClass32_0.<g__Init|0>d.MoveNext()

OK

`

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

ehardebeck commented 6 days ago

Looks like I duplicated this issue, with a few more details https://github.com/MicrosoftEdge/WebView2Feedback/issues/4884

aluhrs13 commented 5 days ago

This seems to be a regression with Windows 10 KB5044273 and we're following up with Windows.

CanBanDan commented 1 day ago

Thanks @aluhrs13. Appreciate your help. If you have any updates I'd really appreciate them. I totally understand that this is an upstream issue but it's a really serious problem for us! Our support conversations with MS have not been very fruitful so far.