diff --git a/src/Discord.Net.WebSocket/ConnectionManager.cs b/src/Discord.Net.WebSocket/ConnectionManager.cs index 53feae1b4..65adc1583 100644 --- a/src/Discord.Net.WebSocket/ConnectionManager.cs +++ b/src/Discord.Net.WebSocket/ConnectionManager.cs @@ -103,10 +103,10 @@ namespace Discord finally { _stateLock.Release(); } }); } - public virtual async Task StopAsync() + public virtual Task StopAsync() { Cancel(); - await Task.CompletedTask; + return Task.CompletedTask; } private async Task ConnectAsync(CancellationTokenSource reconnectCancelToken) diff --git a/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs b/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs index e92b31b8d..c8496807e 100644 --- a/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs +++ b/src/Discord.Net.WebSocket/Net/DefaultUdpSocket.cs @@ -118,14 +118,12 @@ namespace Discord.Net.Udp { var receiveTask = _udp.ReceiveAsync(); -#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed - receiveTask.ContinueWith((recieveResult) => + _ = receiveTask.ContinueWith((recieveResult) => { //observe the exception as to not recieve as unhandled exception _ = recieveResult.Exception; }, TaskContinuationOptions.OnlyOnFaulted); -#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed var task = await Task.WhenAny(closeTask, receiveTask).ConfigureAwait(false); if (task == closeTask)