Azure / azure-iot-sdk-csharp

A C# SDK for connecting devices to Microsoft Azure IoT services
Other
468 stars 492 forks source link

[Bug Report] PnP APIs: DeviceClient.GetClientPropertiesAsync doesn’t work for AMQP #2093

Closed wickste closed 3 years ago

wickste commented 3 years ago

Context

Microsoft.Azure.Devices.Client 1.38.0-preview-001

Description of the issue

DeviceClient.GetClientPropertiesAsync throws exception when using TransportType = AMQP

Code sample exhibiting the issue

DeviceClient.GetClientPropertiesAsync()

Console log of the issue

Unhandled exception. System.NotImplementedException: This operation is currently not supported over AMQP, please use MQTT protocol instead. Note that you can still retrieve a client's properties using DeviceClient.GetTwinAsync(CancellationToken cancellationToken) or ModuleClient.GetTwinAsync(CancellationToken cancellationToken) operations, but the properties will not be formatted as per DTDL terminology.
   at Microsoft.Azure.Devices.Client.Transport.Amqp.AmqpTransportHandler.GetPropertiesAsync(PayloadConvention payloadConvention, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.DefaultDelegatingHandler.GetPropertiesAsync(PayloadConvention payloadConvention, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.DefaultDelegatingHandler.GetPropertiesAsync(PayloadConvention payloadConvention, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.<>n__21(PayloadConvention payloadConvention, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.<>c__DisplayClass23_0.<GetPropertiesAsync>b__0()
  at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.ExecuteWithErrorHandlingAsync[T](Func`1 asyncOperation)
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.<>c__DisplayClass34_0.<<GetPropertiesAsync>b__0>d.MoveNext()
abhipsaMisra commented 3 years ago

This is a known current limitation of the previewed code, we haven't added support for convention-based operations over amqp yet. Amqp support isn't something that external users rely on for pnp, so we didn't focus on it for the preview release. We do plan to support this before promoting the code to GA though.

abhipsaMisra commented 3 years ago

@wickste This issue is being tracked by our backlog, so if you're ok with it I'll close this issue here and use the ADO item for tracking instead.

abhipsaMisra commented 3 years ago

Closing this issue since we're tracking this on ADO instead. The plan is to enable AMQP support before we promote the code to master.