Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] [v2] Multiple calls to direct methond after reconnect #3354

Closed
jenscski opened this issue Jul 26, 2023 · 4 comments
Closed

[Bug Report] [v2] Multiple calls to direct methond after reconnect #3354

jenscski opened this issue Jul 26, 2023 · 4 comments
Assignees
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

Comments

@jenscski
Copy link

Context

  • OS, version, SKU and CPU architecture used: Windows 11
  • Application's .NET Target Framework : net6.0
  • Device: Windows Console app and .NET Maui (Samsung s32)
  • SDK version used: 2.0.0-preview005

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

@jenscski jenscski added the bug Something isn't working. label Jul 26, 2023
@github-actions github-actions bot added the IoTSDK Tracks all IoT SDK issues across the board label Jul 26, 2023
@jenscski jenscski changed the title [Bug Report] [v2] [Bug Report] [v2] Multiple calls to direct methond after reconnect Jul 26, 2023
@tmahmood-microsoft tmahmood-microsoft self-assigned this Aug 7, 2023
@tmahmood-microsoft
Copy link
Contributor

Hi @jenscski, thank you so much for evaluating previews/v2 and reporting this issue.
I was able to reproduce and fix the issue, you can find the latest code changes here: #3359

Please let me know if it still does not work for you or if you face any more issues.

@tmahmood-microsoft tmahmood-microsoft added the fix-checked-in Fix checked into main or preview, but not yet released. label Aug 9, 2023
@helynranta
Copy link

Hi @tmahmood-microsoft, we had similar issue and I was able to verify that your fix solves it. Can you publish new preview package which includes this?

@tmahmood-microsoft
Copy link
Contributor

@helynranta thank you for confirming the fix. Yes I am currently in process of publishing a new preview package. Should have it for you in a day or two.

@tmahmood-microsoft
Copy link
Contributor

Hi @helynranta, @jenscski I am attaching link to the latest release package for v2 preview containing this fix, please let me know if you face any more issues and thank you for evaluating the preview release.

https://github.com/Azure/azure-iot-sdk-csharp/releases/tag/preview_2023-08-14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

3 participants