diff --git a/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs b/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs index 4b37de28f..82079e9bd 100644 --- a/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs +++ b/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs @@ -130,6 +130,14 @@ namespace Discord.Net.Udp while (!cancelToken.IsCancellationRequested) { var receiveTask = _udp.ReceiveAsync(); + + _ = receiveTask.ContinueWith((receiveResult) => + { + //observe the exception as to not receive as unhandled exception + _ = receiveResult.Exception; + + }, TaskContinuationOptions.OnlyOnFaulted); + var task = await Task.WhenAny(closeTask, receiveTask).ConfigureAwait(false); if (task == closeTask) break;