From 008bb2b06b1d0a420be33900d62a04257f703fb4 Mon Sep 17 00:00:00 2001 From: Neeraj Makam Date: Fri, 25 Oct 2019 12:54:25 -0700 Subject: [PATCH 1/2] Ignoring OperationCanceledException when pump is stopping. --- .../src/MessageReceivePump.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/MessageReceivePump.cs b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/MessageReceivePump.cs index 349e3cb3e8c1c..f918b32e146d9 100644 --- a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/MessageReceivePump.cs +++ b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/MessageReceivePump.cs @@ -108,14 +108,18 @@ async Task MessagePumpTaskAsync() } }); } + catch (OperationCanceledException) when (pumpCancellationToken.IsCancellationRequested) + { + // Ignore as we are stopping the pump + } + catch (ObjectDisposedException) when (pumpCancellationToken.IsCancellationRequested) + { + // Ignore as we are stopping the pump + } catch (Exception exception) { - // Not reporting an ObjectDisposedException as we're stopping the pump - if (!(exception is ObjectDisposedException && this.pumpCancellationToken.IsCancellationRequested)) - { - MessagingEventSource.Log.MessageReceivePumpTaskException(this.messageReceiver.ClientId, string.Empty, exception); - await this.RaiseExceptionReceived(exception, ExceptionReceivedEventArgsAction.Receive).ConfigureAwait(false); - } + MessagingEventSource.Log.MessageReceivePumpTaskException(this.messageReceiver.ClientId, string.Empty, exception); + await this.RaiseExceptionReceived(exception, ExceptionReceivedEventArgsAction.Receive).ConfigureAwait(false); } } } From 428b3e4aabb67065768649ddf52d205aaf0664a8 Mon Sep 17 00:00:00 2001 From: Neeraj Makam Date: Fri, 25 Oct 2019 16:20:27 -0700 Subject: [PATCH 2/2] Updating changelog and version to 4.1.1 --- sdk/servicebus/Microsoft.Azure.ServiceBus/changelog.md | 4 ++++ .../src/Microsoft.Azure.ServiceBus.csproj | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sdk/servicebus/Microsoft.Azure.ServiceBus/changelog.md b/sdk/servicebus/Microsoft.Azure.ServiceBus/changelog.md index 06806902d18d4..0bc9aac604fad 100644 --- a/sdk/servicebus/Microsoft.Azure.ServiceBus/changelog.md +++ b/sdk/servicebus/Microsoft.Azure.ServiceBus/changelog.md @@ -1,3 +1,7 @@ +# 4.1.1 +## Bug fixes +- Ignore OperationCanceledException while closing Message Pump. [PR 8449](https://github.com/Azure/azure-sdk-for-net/pull/8449) + # 4.1.0 ## Improvements - Support for creation of `SqlFilter` for subscriptions with parameter of type `TimeSpan`. [PR 7325](https://github.com/Azure/azure-sdk-for-net/pull/7325) diff --git a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Microsoft.Azure.ServiceBus.csproj b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Microsoft.Azure.ServiceBus.csproj index 0946e7afab89b..2db2c51583e0b 100644 --- a/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Microsoft.Azure.ServiceBus.csproj +++ b/sdk/servicebus/Microsoft.Azure.ServiceBus/src/Microsoft.Azure.ServiceBus.csproj @@ -2,7 +2,7 @@ Azure ServiceBus SDK This is the next generation Azure Service Bus .NET Standard client library that focuses on queues & topics. For more information about Service Bus, see https://azure.microsoft.com/en-us/services/service-bus/ - 4.1.0 + 4.1.1 Microsoft;Azure;Service Bus;ServiceBus;.NET;AMQP;IoT;Queue;Topic