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

[WebView] UnobservedTaskException: RPC_E_SERVER_DIED when calling CreateWebViewControlAsync #247

Open DominikPalo opened 4 years ago

DominikPalo commented 4 years ago

While inspecting occasional crashes of our WPF app (a few clients reported that issue, although I was not able to reproduce it on developer issue) I found that crashes are caused by an UnobservedTaskException bubbled from the WebView component. So I've added logging for all unobserved exceptions and here is the full exception (it is always the same):

Exception:

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))
  Module "System.Runtime.CompilerServices.TaskAwaiter", in ThrowForNonSuccess
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  File "d:\a\1\s\WebView.Shared\Interop\WinRT\WebViewControlProcess.cs", line 96, col 13, in CreateWebViewControlHostAsync
  Module "System.Runtime.CompilerServices.TaskAwaiter", in ThrowForNonSuccess
  Module "System.Runtime.CompilerServices.TaskAwaiter", in HandleNonSuccessAndDebuggerNotification
  File "d:\a\1\s\Microsoft.Toolkit.Wpf.UI.Controls.WebView\WebView.cs", line 789, col 25, in MoveNext

Could you please help? Because that exception is fired from the WebView component, I'm not able to deal with it... of course, I can prevent app crashes by calling the UnobservedTaskExceptionEventArgs.SetObserverd() in the TaskScheduler.UnobservedTaskException, but then the WebView doesn't work until the app is manually restarted.

Kyaa-dost commented 4 years ago

@pagoe-msft ⬆️

ndreisg commented 4 years ago

This issue was already reported here: #223 But interestingly this issue was closed without any fix or any comment why it's being closed.