Skip to content

QuicConnection.DisposeAsync throws OperationCanceledException #78641

@bentoi

Description

@bentoi

Description

The attached test case demonstrates that QuicConnection.DisposeAsync throws OperationCanceledException.

Also, looking at the implementation of QuicConnection.DisposeAsync, DisposeAsync is not a silent close as described by the documentation. It's a graceful close that sends a close frame with the DefaultCloseErrorCode.

This also raises the question of what DisposeAsync should do if CloseAsync is canceled.

Reproduction Steps

Run the attach program with a Kestrel server.

quic-client.zip

Expected behavior

operation canceled

Actual behavior

operation canceled
Unhandled exception. System.OperationCanceledException: The operation was canceled.
   at System.Net.Quic.ValueTaskSource.TryComplete(Exception exception)
   at System.Net.Quic.ValueTaskSource.<>c.<TryInitialize>b__10_0(Object obj, CancellationToken cancellationToken)
   at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException)
   at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)
   at System.Threading.TimerQueue.FireNextTimers()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
--- End of stack trace from previous location ---
   at System.Net.Quic.ValueTaskSource.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Quic.QuicConnection.DisposeAsync()
   at Program.Main(String[] args) in /home/vagrant/workspace/quic-client/Program.cs:line 35
   at Program.Main(String[] args) in /home/vagrant/workspace/quic-client/Program.cs:line 35
   at Program.<Main>(String[] args)

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions