MicrosoftEdge / WebView2Feedback

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

[Problem/Bug]: "System.Runtime.InteropServices.COMException(HRESULT: 0x887A002D)" issue when using WebView2CompositionControl on older Windows 10 versions. #4755

Closed Jang-Haemin closed 2 months ago

Jang-Haemin commented 2 months ago

What happened?

Hello?

I'm really happy to see that you have released a WebView2CompositionControl to solve the Z-Index problem in WPF WebView2.

However, I was wondering if you could confirm the conditions for running the pre-release build.

My program is built with .NET 4.6.2, WPF, x86 and I use WebView2 1.0.2730-prerelease to deploy WebView2CompositionControl.

When I run this program on a developer PC, it works fine, but on some PCs, I get the following error

Error stack: System.Runtime.InteropServices.COMException: The application requested an operation that depends on a missing or mismatched SDK component. (Exception in HRESULT: 0x887A002D) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.Web.WebView2.Wpf.Direct3DHelper.CreateDevice(ID3D11Device& device, ID3D11DeviceContext& deviceContext) at Microsoft.Web.WebView2.Wpf.GraphicsItemD3DImage..ctor(IntPtr mainWindowHandle, Image image, Int32 fpsDivider) at Microsoft.Web.WebView2.Wpf.WebView2CompositionControl.WebView2CompositionControl_Loaded(Object sender, RoutedEventArgs e) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e) at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent) at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root) at MS.Internal.LoadedOrUnloadedOperation.DoWork() at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks() at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget) at System.Windows.Interop.HwndTarget.OnResize() at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam) at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

The components on the PC that caused this error were

ℹ️ This PC is being used as a kiosk PC and uses Windows 10 LTSC. This makes it difficult to update the Windows version.

What can I do to resolve this issue? For reference, I did not encounter this issue when using the WPF WebView2 control on the same WebView2 version.

Thanks.

Importance

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

Runtime Channel

Prerelease (Edge Canary/Dev/Beta)

Runtime Version

127.0.2651.105

SDK Version

1.0.2730-prerelease

Framework

WPF

Operating System

Windows 10

OS Version

19044.4651

Repro steps

  1. install the Microsoft.Web.WebView2 1.0.2730-prerelease Nuget package, place and build the WebView2CompositionControl in your .NET 4.6.2, x86, WPF app.

  2. When you run the app, you will receive the following error: System.Runtime.InteropServices.COMException: The application requested an operation that depends on a missing or mismatched SDK component. (Exception in HRESULT: 0x887A002D) An error occurs.

  3. However, if you use a WebView2 control instead of a WebView2CompositionControl in the same Nuget package, this issue does not occur and it runs fine.

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

retmas-dv commented 2 months ago

To resolve this issue add Windows optional feature "Graphic tools". For example using the following PowerShell command:

dism /Online /Add-Capability /CapabilityName:Tools.Graphics.DirectX~~~~0.0.1.0

The correct version of the package can be found using the following PowerShell command:

dism.exe /Online /Get-Capabilities /Format:Table | Select-String "Tools.Graphics.DirectX"

Jang-Haemin commented 2 months ago

To resolve this issue add Windows optional feature "Graphic tools". For example using the following PowerShell command:

dism /Online /Add-Capability /CapabilityName:Tools.Graphics.DirectX~~~~0.0.1.0

The correct version of the package can be found using the following PowerShell command:

dism.exe /Online /Get-Capabilities /Format:Table | Select-String "Tools.Graphics.DirectX"

As you said, after installing the "Graphic tools", I confirmed that the program runs well. Thank you so much!!!! 😊😊😊