From 279665688257e2e6a8f264c83e8f504a68f37048 Mon Sep 17 00:00:00 2001 From: Luke Bakken Date: Thu, 9 Jan 2025 16:01:51 -0800 Subject: [PATCH] * Additional `_disposed` checks. --- projects/RabbitMQ.Client/Impl/Channel.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/RabbitMQ.Client/Impl/Channel.cs b/projects/RabbitMQ.Client/Impl/Channel.cs index 7293f584c..c29c17780 100644 --- a/projects/RabbitMQ.Client/Impl/Channel.cs +++ b/projects/RabbitMQ.Client/Impl/Channel.cs @@ -529,6 +529,11 @@ void IDisposable.Dispose() protected virtual void Dispose(bool disposing) { + if (_disposed) + { + return; + } + if (IsDisposing) { return; @@ -559,6 +564,11 @@ protected virtual void Dispose(bool disposing) public async ValueTask DisposeAsync() { + if (_disposed) + { + return; + } + await DisposeAsyncCore() .ConfigureAwait(false); @@ -567,6 +577,11 @@ await DisposeAsyncCore() protected virtual async ValueTask DisposeAsyncCore() { + if (_disposed) + { + return; + } + if (IsDisposing) { return;