1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-10 09:26:22 +00:00

Replaced TaskCanceledException catches with OperationCanceledException catches for .net framework

This commit is contained in:
Jkorf 2021-08-13 15:45:20 +02:00
parent 3d8c33094d
commit 05805c87c2
3 changed files with 9 additions and 7 deletions

View File

@ -3818,7 +3818,9 @@
<member name="M:CryptoExchange.Net.Sockets.WebsocketFactory.CreateWebsocket(CryptoExchange.Net.Logging.Log,System.String,System.Collections.Generic.IDictionary{System.String,System.String},System.Collections.Generic.IDictionary{System.String,System.String})">
<inheritdoc />
</member>
<member name="T:System.Diagnostics.CodeAnalysis.AllowNullAttribute">
</members>
</doc>
System.Diagnostics.CodeAnalysis.AllowNullAttribute">
<summary>
Specifies that <see langword="null"/> is allowed as an input even if the
corresponding type disallows it.

View File

@ -284,7 +284,7 @@ namespace CryptoExchange.Net
log.Write(LogLevel.Warning, $"[{request.RequestId}] Request exception: " + exceptionInfo);
return new WebCallResult<T>(null, null, default, new WebError(exceptionInfo));
}
catch (TaskCanceledException canceledException)
catch (OperationCanceledException canceledException)
{
if (canceledException.CancellationToken == cancellationToken)
{

View File

@ -339,7 +339,7 @@ namespace CryptoExchange.Net.Sockets
{
await _socket.SendAsync(new ArraySegment<byte>(data, 0, data.Length), WebSocketMessageType.Text, true, _ctsSource.Token).ConfigureAwait(false);
}
catch (TaskCanceledException)
catch (OperationCanceledException)
{
// cancelled
break;
@ -377,9 +377,9 @@ namespace CryptoExchange.Net.Sockets
receiveResult = await _socket.ReceiveAsync(buffer, _ctsSource.Token).ConfigureAwait(false);
received += receiveResult.Count;
}
catch (TaskCanceledException)
catch (OperationCanceledException)
{
// Cancelled
// cancelled
break;
}
catch (WebSocketException wse)
@ -513,10 +513,10 @@ namespace CryptoExchange.Net.Sockets
{
await Task.Delay(500, _ctsSource.Token).ConfigureAwait(false);
}
catch(TaskCanceledException)
catch (OperationCanceledException)
{
// cancelled
return;
break;
}
}
}