diff --git a/projects/RabbitMQ.Client/RabbitMQ.Client.csproj b/projects/RabbitMQ.Client/RabbitMQ.Client.csproj index 773051fcd1..525b76c192 100755 --- a/projects/RabbitMQ.Client/RabbitMQ.Client.csproj +++ b/projects/RabbitMQ.Client/RabbitMQ.Client.csproj @@ -27,6 +27,7 @@ true ..\..\packages true + RabbitMQ.ruleset @@ -53,6 +54,7 @@ + diff --git a/projects/RabbitMQ.Client/RabbitMQ.ruleset b/projects/RabbitMQ.Client/RabbitMQ.ruleset new file mode 100644 index 0000000000..09e5af182a --- /dev/null +++ b/projects/RabbitMQ.Client/RabbitMQ.ruleset @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/projects/RabbitMQ.Client/client/impl/ConsumerWorkService.cs b/projects/RabbitMQ.Client/client/impl/ConsumerWorkService.cs index 4813fdaf8e..30109fad68 100644 --- a/projects/RabbitMQ.Client/client/impl/ConsumerWorkService.cs +++ b/projects/RabbitMQ.Client/client/impl/ConsumerWorkService.cs @@ -143,7 +143,8 @@ private static async Task OffloadToWorkerThreadPool(Action action, SemaphoreSlim await Task.Factory.StartNew(state => { ((Action)state)(); - }, action, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default); + }, action, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default) + .ConfigureAwait(false); } catch (Exception) { diff --git a/projects/RabbitMQ.Client/client/impl/SocketFrameHandler.cs b/projects/RabbitMQ.Client/client/impl/SocketFrameHandler.cs index e3517a3be0..b783ec9c25 100644 --- a/projects/RabbitMQ.Client/client/impl/SocketFrameHandler.cs +++ b/projects/RabbitMQ.Client/client/impl/SocketFrameHandler.cs @@ -50,11 +50,11 @@ public static async Task TimeoutAfter(this Task task, TimeSpan timeout) { if (task == await Task.WhenAny(task, Task.Delay(timeout)).ConfigureAwait(false)) { - await task; + await task.ConfigureAwait(false); } else { - Task supressErrorTask = task.ContinueWith(t => t.Exception.Handle(e => true), TaskContinuationOptions.OnlyOnFaulted); + Task supressErrorTask = task.ContinueWith((t, s) => t.Exception.Handle(e => true), null, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default); throw new TimeoutException(); } } diff --git a/projects/Unit/Unit.csproj b/projects/Unit/Unit.csproj index 7bc6f0b2ec..ced3385b95 100755 --- a/projects/Unit/Unit.csproj +++ b/projects/Unit/Unit.csproj @@ -4,6 +4,7 @@ net461;netcoreapp3.1 ../rabbit.snk true + false