azure-sdk-for-net: ServiceBus fails to send messages if folder contains Microsoft.Azure.Amqp version 2.5.8 instead of 2.5.6

The following exception is thrown when output folder contains Microsoft.Azure.Amqp version= 2.5.8 and 'Azure.Messaging.ServiceBus version=7.5.1.0:

The type initializer for ‘Azure.Messaging.ServiceBus.Amqp.AmqpTransactionManager’ threw an exception. —> System.TypeInitializationException: The type initializer for ‘Azure.Messaging.ServiceBus.Amqp.AmqpTransactionManager’ threw an exception. —> System.TypeLoadException: Method ‘OnCreateAsync’ in type ‘Azure.Messaging.ServiceBus.Amqp.AmqpTransactionEnlistment’ from assembly ‘Azure.Messaging.ServiceBus, Version=7.5.1.0, Culture=neutral, PublicKeyToken=92742159e12e44c8’ does not have an implementation. at Azure.Messaging.ServiceBus.Amqp.AmqpTransactionManager…ctor() at Azure.Messaging.ServiceBus.Amqp.AmqpTransactionManager…cctor() — End of inner exception stack trace — at Azure.Messaging.ServiceBus.Amqp.AmqpTransactionManager.get_Instance() at Azure.Messaging.ServiceBus.Amqp.AmqpSender.SendBatchInternalAsync(IEnumerable1 messages, TimeSpan timeout, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.Amqp.AmqpSender.SendBatchInternalAsync(IEnumerable1 messages, TimeSpan timeout, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.Amqp.AmqpSender.<>c.<<SendBatchAsync>b__18_0>d.MoveNext() — End of stack trace from previous location — at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.<>c__201.<<RunOperation>b__20_0>d.MoveNext() --- End of stack trace from previous location --- at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation[T1,TResult](Func4 operation, T1 t1, TransportConnectionScope scope, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation[T1,TResult](Func4 operation, T1 t1, TransportConnectionScope scope, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation[T1](Func4 operation, T1 t1, TransportConnectionScope scope, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.Amqp.AmqpSender.SendBatchAsync(ServiceBusMessageBatch messageBatch, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.ServiceBusSender.SendMessagesAsync(ServiceBusMessageBatch messageBatch, CancellationToken cancellationToken)

This is because after version 2.5.6 Microsoft.Azure.Amqp contains breaking change: base class named Singleton changed OnCreateAsync method parameters and Azure.Messaging.ServiceBus.Amqp.AmqpTransactionManager cannot be instantiated anymore as abstract method is not implemented.

Note that assembly version of Microsoft.Azure.Amqp did not change at all. I don’t think it is correct way to do breaking changes.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Looks like this was a breaking change in the Microsoft.Azure.Amqp library, introduced in v2.5.7 by this commit. I’ll open an issue in the repository where the AMQP package is maintained and also reach out to the team that owns the package to see if they’re able to make a patch release.

In the meantime, are you able to revert to v2.5.6 of the AMQP package?

SBRepro.zip here is a test project

I think that I see the issue; the AMQP library added a new abstract that we missed when fixing their API compatibility.

Version 2.5.9 of the Microsoft.Azure.Amqp package has been published (and 2.5.8 has been de-listed.) I was able to successfully run a project that referenced and used both 2.5.9 and the latest Service Bus GA. Please let us know if you continue to see issues after upgrading.

Thank you for confirming, @klioqc. We’ve opened #213 and submitted #214 in the repository where the AMQP package is maintained. We’ve also started an internal discussion with the owners of the Microsoft.Azure.Amqp library, asking for them to help get a fix out and delist v2.5.8 from NuGet.