WebView icon indicating copy to clipboard operation
WebView copied to clipboard

Unhandled TaskCanceledException on App Exit with Avalonia 11.2.3 and WebView 3.120.8

Open Jackhammer88 opened this issue 10 months ago • 0 comments

Description:

When using Avalonia 11.2.3 with WebView 3.120.8, an unhandled exception occurs on application exit. The issue happens in a basic scenario — simply opening a page in WebView and then closing the app.

Steps to Reproduce:

  1. Create a basic Avalonia app with WebView (e.g., Avalonia 11.2.3 and WebView 3.120.8).
  2. Add WebView to MainWindow and open any webpage.
  3. Close the application.

Expected Behavior:

The application should close gracefully without errors.

Actual Behavior:

The application crashes with the following error:

Unhandled exception. System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Avalonia.Threading.DispatcherOperation.Wait(TimeSpan) + 0x1bc
   at Avalonia.Threading.Dispatcher.InvokeImpl(DispatcherOperation, CancellationToken, TimeSpan) + 0x186
   at Avalonia.Threading.Dispatcher.Send(SendOrPostCallback, Object, Nullable`1) + 0xcb
   at Avalonia.Threading.AvaloniaSynchronizationContext.Send(SendOrPostCallback, Object) + 0x4a
   at Tmds.DBus.Protocol.DBusConnection.Observer.Dispose(Exception, Boolean) + 0x60
   at Tmds.DBus.Protocol.DBusConnection.Dispose() + 0x241
   at Tmds.DBus.Protocol.Connection.Disconnect(Exception, DBusConnection) + 0xc8
   at Tmds.DBus.Protocol.DBusConnection.<HandleMessages>d__38.MoveNext() + 0x77d
Aborted (core dumped)

Environment:

Avalonia: 11.2.3 WebView: 3.120.8 OS: ALT Linux Starterkit 11 (Salvia) .NET: 8

Additional Context:

The stack trace indicates the issue is related to Tmds.DBus.Protocol during the disposal process, suggesting an unhandled asynchronous operation (TaskCanceledException).

Jackhammer88 avatar Feb 18 '25 08:02 Jackhammer88