MicrosoftEdge / WebView2Feedback

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

[Problem/Bug]: The WebView control is no longer valid because the browser process crashed #4452

Closed Paulismo closed 5 months ago

Paulismo commented 6 months ago

What happened?

A few of our big customer's employees(3-4 people) are currently facing an issue with the latest(122) version of the webview runtime and Microsoft.Web.WebView2 v1.0.1462.37. When they open our app they're faced with the following message:

System.InvalidOperationException: The WebView control is no longer valid because the browser process crashed.To work around this, please listen for the CoreWebView2.ProcessFailed event to explicitly manage the lifetime of the WebView2 control in the event of a browser failure.https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.processfailed at Microsoft.Web.WebView2.Wpf.WebView2.VerifyBrowserNotCrashed() at Microsoft.Web.WebView2.Wpf.WebView2.get_CoreWebView2() at Microsoft.Web.WebView2.Wpf.WebView2.TabIntoCore(TraversalRequest request) at System.Windows.Interop.HwndHost.System.Windows.Interop.IKeyboardInputSink.TabInto(TraversalRequest request) at System.Windows.Input.KeyboardNavigation.Navigate(DependencyObject currentElement, TraversalRequest request, ModifierKeys modifierKeys, DependencyObject firstElement, Boolean fromProcessInputTabKey) at System.Windows.FrameworkElement.MoveFocus(TraversalRequest request) at System.Windows.Controls.TabItem.OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e) at ActiproSoftware.Windows.Controls.Docking.AdvancedTabItem.OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed) at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed) at System.Windows.Input.KeyboardDevice.Focus(IInputElement element) at System.Windows.UIElement.Focus() at System.Windows.Controls.TabItem.SetFocus() at System.Windows.Controls.TabControl.OnSelectionChanged(SelectionChangedEventArgs e) at ActiproSoftware.Windows.Controls.Docking.AdvancedTabControl.OnSelectionChanged(SelectionChangedEventArgs e) at System.Windows.Controls.Primitives.Selector.InvokeSelectionChanged(List1 unselectedInfos, List1 selectedInfos) at System.Windows.Controls.Primitives.Selector.SetSelectedHelper(Object item, FrameworkElement UI, Boolean selected) at System.Windows.Controls.Primitives.Selector.NotifyIsSelectedChanged(FrameworkElement container, Boolean selected, RoutedEventArgs e) at System.Windows.Controls.Primitives.Selector.OnSelected(Object sender, RoutedEventArgs e) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at ActiproSoftware.Windows.Controls.Docking.AdvancedTabItem.OnSelected(RoutedEventArgs e) at System.Windows.Controls.TabItem.OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at System.Windows.Controls.TabItem.set_IsSelected(Boolean value) at ActiproSoftware.Windows.Controls.Docking.AdvancedTabItem.s25(Object , InputPointerButtonEventArgs ) at ActiproSoftware.Windows.Input.InputAdapter.XIi(Object , InputEventArgs , InputPointerButtonKind ) at ActiproSoftware.Windows.Input.InputAdapter.TIh(Object , InputEventArgs ) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(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)

On a separate note, there are no webview runtime related child processes spawned as a result of us trying to open a webview browser window in our app on their machine. So I presume they're either killed before they can even show up in the task manager or they're being prevented from starting up at all.

We tried to look into the event viewer to see whether there is anything logged in there but didn't see anything even remotely related.

Please share some insights on what could we implement to help our users.

Importance

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

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

122.0.2365.92

SDK Version

1.0.1462.37

Framework

WPF

Operating System

Windows 10, Windows 11

OS Version

No response

Repro steps

There are no specific steps that we know of, it just doesn't work from the moment you open the app. The issue is also pretty rare and for a little while it seemed to be fixed with no input from our side but then it broke again, I suspect that happened when the user switched from 121 to 122 or due to some change in user's machine, that were not disclosed, as they can't recall their actions before and after the problem went away and came back.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Regression in newer Runtime

Last working version (if regression)

SDK 1.0.1462.37 Runtime 115

AB#49174522

victorhuangwq commented 6 months ago

Could you attach a crash dump as a comment?

WV2 crash dumps are located in a subfolder of the app's user data folder (UDF): \EBWebView\Crashpad\reports. By default, the user data folder is created in the app's folder with a name like .exe.WebView2. Refer to Crash Diagnostics for more information.

Thanks!

champnic commented 5 months ago

@Paulismo We just checked in a change today that should resolves crashes stemming from "TabIntoCore", like your current stack does. It should be available for you to test out in our next prerelease SDK. Thanks!

Paulismo commented 5 months ago

Hi Victor, sorry but we're still waiting for the crash dump.

Paulismo commented 5 months ago

@champnic Thanks for the good news, I will send a new build to our user.