CommunityToolkit / Microsoft.Toolkit.Win32

ARCHIVE - This repository contained XAML Islands wrapper controls and tooling for XAML Islands with WinUI 2, see readme for more info about XAML Islands with WinUI 3 and the WindowsAppSDK.
https://aka.ms/windowsappsdk
Other
383 stars 89 forks source link

Creating WebViewCompatible Control throws Exception (HResult 0x80010007 (RPC_E_SERVER_DIED)) #301

Closed adam-g1 closed 3 years ago

adam-g1 commented 3 years ago

Hello,

We have a couple customers who cannot launch applications with a WebViewCompatible control embedded in our WinForms application. When attempting to open a form with a WebViewCompatible (or WebView) control, they get the following exception thrown. Does anyone know why this may be failing?

System.Exception: The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call may have executed. (Exception from HRESULT: 0x80010007 (RPC_E_SERVER_DIED)) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlProcess.d__16.MoveNext() in d:\a\1\s\WebView.Shared\Interop\WinRT\WebViewControlProcess.cs:line 96 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Toolkit.Forms.UI.Controls.WebViewControlProcessExtensions.CreateWebViewControlHost(WebViewControlProcess process, IntPtr hostWindowHandle, Rectangle bounds) in d:\a\1\s\Microsoft.Toolkit.Forms.UI.Controls.WebView\WebViewControlProcessExtensions.cs:line 178 at Microsoft.Toolkit.Forms.UI.Controls.WebView.Initialize() in d:\a\1\s\Microsoft.Toolkit.Forms.UI.Controls.WebView\WebView.Init.cs:line 129 at Microsoft.Toolkit.Forms.UI.Controls.WebView.System.ComponentModel.ISupportInitialize.EndInit() in d:\a\1\s\Microsoft.Toolkit.Forms.UI.Controls.WebView\WebView.Init.cs:line 67 at Microsoft.Toolkit.Forms.UI.Controls.WebViewCompatibilityAdapter.Initialize() in d:\a\1\s\Microsoft.Toolkit.Forms.UI.Controls.WebView\WebViewCompatibilityAdapter.cs:line 134 at Microsoft.Toolkit.Forms.UI.Controls.WebViewCompatible..ctor() in d:\a\1\s\Microsoft.Toolkit.Forms.UI.Controls.WebView\WebViewCompatible.cs:line 28 at WebViewTesting.frmWebView.InitializeComponent() in C:\Users\agarr\source\repos\WebViewTesting\WebViewTesting\frmWebView.Designer.vb:line 25 at WebViewTesting.frmWebView..ctor(TextBox txtLog, Boolean shouldCatch) in C:\Users\agarr\source\repos\WebViewTesting\WebViewTesting\frmWebView.vb:line 5 at WebViewTesting.Form1.btnOpenWebView_Click(Object sender, EventArgs e) in C:\Users\agarr\source\repos\WebViewTesting\WebViewTesting\Form1.vb:line 29 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

When checking Event Viewer, the following event is present:

Faulting application name: Win32WebViewHost.exe, version: 10.0.19041.423, time stamp: 0x6ff6d124 Faulting module name: KERNELBASE.dll, version: 10.0.19041.662, time stamp: 0xec58f015 Exception code: 0xc0000409 Fault offset: 0x000000000010bd5c Faulting process id: 0x2ad0 Faulting application start time: 0x01d6e5e2d6ce7118 Faulting application path: C:\WINDOWS\SystemApps\Microsoft.Win32WebViewHost_cw5n1h2txyewy\Win32WebViewHost.exe Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll Report Id: 999e2670-1f5f-4bda-8346-02ef2e99c767 Faulting package full name: Microsoft.Win32WebViewHost_10.0.19041.423_neutral_neutral_cw5n1h2txyewy Faulting package-relative application ID: DPI.Unaware

michael-hawker commented 3 years ago

@adam-g1 this seems similar to #299? Please try WebView2 instead. FYI @pagoe-msft.

adam-g1 commented 3 years ago

We were able to solve it for one customer by re-creating the windows user on that machine. For customers where that wasn't an option, we've migrated to a WebView2 solution.