Azure-iot-sdk-csharp: DeviceClient.SendEventBatchAsync over AMQP throws InvalidOperationException with SDK 1.21.2 version

Created on 4 Dec 2019  路  6Comments  路  Source: Azure/azure-iot-sdk-csharp

Description of the issue:

Sending messages in batch mode over AMQP seems to throw InvalidOperationException with the 1.21.2 version of the SDK. This is a regression, and does not repro with 1.20.3 version of the SDK. This does not repro with MQTT.

Code sample exhibiting the issue:

        static async Task SendAmqpMessages(string connectionString)
        {
            var dc = DeviceClient.CreateFromConnectionString(connectionString);
            await dc.OpenAsync();

            var msgs = new List<Message>();
            for (int i = 0; i < 2; i++)
            {
                msgs.Add(new Message());
            }

            await dc.SendEventBatchAsync(msgs);
        }

Console log of the issue:

System.AggregateException
  HResult=0x80131500
  Message=One or more errors occurred. (Operation is not valid due to the current state of the object.)
  Source=System.Private.CoreLib
  StackTrace:
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at SDKTest1212.Program.Main(String[] args) in C:\Users\vpuranik.REDMOND\source\repos\SDKTest1212\Program.cs:line 14

Inner Exception 1:
InvalidOperationException: Operation is not valid due to the current state of the object.

bug fix-checked-in

All 6 comments

This issue has been around for a while, see #1061

I don't know why it has not been fully acknowledged as it is a major issue.

adding my quick debug results (note that AmqpMessage.cs was looked up on GitHub and I did not reconcile it with the actual version - it might be different with an older implementation)

amqpmsgerr

@vipeller Thanks for the help to address this issue. We're now waiting for AMQP library to release a new version from their master to resolve this issue. Meanwhile as you mentioned there are some API break changes in AMQP product, we should make sure those get address before they release.

This issue is root caused to underlying AMQP library. We are waiting for them to release alatest version to update the dependency.

@ntrpnr, @davilu, @prmathur-microsoft, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey

Was this page helpful?
0 / 5 - 0 ratings

Related issues

appalaraju picture appalaraju  路  9Comments

andrejohansson picture andrejohansson  路  6Comments

langebo picture langebo  路  4Comments

dmytro-gokun picture dmytro-gokun  路  10Comments

R25l84IHeXjIxy6HO1QXn0y0Dq9mt8EN picture R25l84IHeXjIxy6HO1QXn0y0Dq9mt8EN  路  5Comments