From b818f5325a979b3ae8deeb2fd98a1bf2a3577103 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Thu, 4 Jul 2024 05:48:35 +1000 Subject: [PATCH] Enable MA0040 and silence remaining case "Flow the cancellation token" --- .global.editorconfig.ini | 2 +- src/BizHawk.Client.Common/Api/ClientWebSocketWrapper.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.global.editorconfig.ini b/.global.editorconfig.ini index 47961da7c6..22d2f09999 100644 --- a/.global.editorconfig.ini +++ b/.global.editorconfig.ini @@ -179,7 +179,7 @@ dotnet_diagnostic.MA0038.severity = silent # Do not write your own certificate validation method dotnet_diagnostic.MA0039.severity = error # Flow the cancellation token -dotnet_diagnostic.MA0040.severity = silent +dotnet_diagnostic.MA0040.severity = error # Make property static dotnet_diagnostic.MA0041.severity = silent # Do not use blocking calls in an async method diff --git a/src/BizHawk.Client.Common/Api/ClientWebSocketWrapper.cs b/src/BizHawk.Client.Common/Api/ClientWebSocketWrapper.cs index c35b8cc52b..65c774dffc 100644 --- a/src/BizHawk.Client.Common/Api/ClientWebSocketWrapper.cs +++ b/src/BizHawk.Client.Common/Api/ClientWebSocketWrapper.cs @@ -17,7 +17,9 @@ namespace BizHawk.Client.Common public ClientWebSocketWrapper(Uri uri, CancellationToken? cancellationToken = null) { _w = new ClientWebSocket(); +#pragma warning disable MA0040 // Analyzer not smart enough to recognise this _w.ConnectAsync(uri, cancellationToken ?? CancellationToken.None).Wait(); +#pragma warning restore MA0040 } /// calls