[Bug Report] [v2] Multiple calls to direct methond after reconnect #3354
Labels
bug
Something isn't working.
fix-checked-in
Fix checked into main or preview, but not yet released.
IoTSDK
Tracks all IoT SDK issues across the board
Context
Description of the issue
When a connection is automatically reconnected (e.g. network drop or similiar), direct method calls is called twice (possibly one more for each reconnect)
I have tested with both disabling my network, and turning "Enable connection to IoT Hub" on and off.
The reason for the error is that MqttTransportHandler.OpenAsync is called upon reconnect, but MqttTransportHandler.CloseAsync is not, so the HandleReceivedMessageAsync method is added again to the MqttClient.ApplicationMessageReceivedAsync event.
Code sample exhibiting the issue
Console log of the issue
The text was updated successfully, but these errors were encountered: