Skip to content

[browser][websocket] Canceling token source before connect should throw OperationCanceledException #44720

@kjpou1

Description

@kjpou1

The WebSocketClient should throw an OperationCanceledException instead of trying to connect and then cancelling.

            using (var clientSocket = new ClientWebSocket())
            {
                var cts = new CancellationTokenSource();
                cts.Cancel();
                Task t = clientSocket.ConnectAsync(new Uri("ws://" + Guid.NewGuid().ToString("N")), cts.Token);
            }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions