Issue Transfer
This issue has been transferred from the Azure SDK for .NET repository, #45055.
Please be aware that @JoeGaggler is the author of the original issue and include them for any questions or replies.
@xinchen10: From what I can see, it doesn't look like there's any client logic in play here - it just calls DeclareAsync on the transaction controller. (src) This follows the same pattern that the T1 library used. (src)
Details
Describe the bug
I am experiencing the same issue as reported in #14836 - however that issue is locked, and so I am refiling this bug.
Stacktrace:
System.InvalidCastException: Unable to cast object of type 'Microsoft.Azure.Amqp.Framing.Accepted' to type 'Microsoft.Azure.Amqp.Transaction.Declared'.
at Microsoft.Azure.Amqp.Transaction.Controller.DeclareAsync(CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.Amqp.AmqpTransactionEnlistment.OnCreateAsync(TimeSpan timeout, CancellationToken cancellationToken)
at Microsoft.Azure.Amqp.Singleton`1.GetOrCreateAsync(TimeSpan timeout, CancellationToken cancellationToken)
at Microsoft.Azure.Amqp.Singleton`1.GetOrCreateAsync(TimeSpan timeout, CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.Amqp.AmqpTransactionManager.EnlistAsync(Transaction transaction, AmqpConnectionScope connectionScope, TimeSpan timeout)
at Azure.Messaging.ServiceBus.Amqp.AmqpSender.SendBatchInternalAsync(AmqpMessage batchMessage, TimeSpan timeout, CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.Amqp.AmqpSender.SendBatchInternalAsync(AmqpMessage batchMessage, TimeSpan timeout, CancellationToken cancellationToken)
at Azure.Messaging.ServiceBus.Amqp.AmqpSender.<>c.<<SendAsync>b__24_0>d.MoveNext()
--- End of stack trace from previous location ---
Expected behavior
App code appears to be correct and is not throwing exceptions, so the expectation is that the ServiceBus library not throw either.
Actual behavior
Exception is thrown and caught internally, but operations might not be succeeding.
Reproduction Steps
using (var transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew, TransactionScopeAsyncFlowOption.Enabled))
{
await receiver.SetSessionStateAsync(binaryData, cancellationToken);
await serviceBusSender.SendMessageAsync(outMessage, cancellationToken); // THROWS HERE! Note: in and out have same session id
await receiver.CompleteMessageAsync(inMessage, CancellationToken.None);
transactionScope.Complete();
}
Environment
Azure Container App
Base Image: mcr.microsoft.com/dotnet/aspnet:8.0
Issue Transfer
This issue has been transferred from the Azure SDK for .NET repository, #45055.
Please be aware that @JoeGaggler is the author of the original issue and include them for any questions or replies.
@xinchen10: From what I can see, it doesn't look like there's any client logic in play here - it just calls
DeclareAsyncon the transaction controller. (src) This follows the same pattern that the T1 library used. (src)Details
Describe the bug
I am experiencing the same issue as reported in #14836 - however that issue is locked, and so I am refiling this bug.
Stacktrace:
Expected behavior
App code appears to be correct and is not throwing exceptions, so the expectation is that the ServiceBus library not throw either.
Actual behavior
Exception is thrown and caught internally, but operations might not be succeeding.
Reproduction Steps
Environment
Azure Container App
Base Image: mcr.microsoft.com/dotnet/aspnet:8.0