Azure / azure-iot-sdk-csharp

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

Bug fix: Direct method subscription not removed after disconnect #3359

Closed tmahmood-microsoft closed 1 year ago

tmahmood-microsoft commented 1 year ago

After a disconnect event, when the client reconnects, client subscribes to message receive event again resulting in multiple calls to direct method callback. The root cause was missing unsubscription after a disconnect event.

github issue: https://github.com/Azure/azure-iot-sdk-csharp/issues/3354

tmahmood-microsoft commented 1 year ago

/azp run

azure-pipelines[bot] commented 1 year ago
Azure Pipelines successfully started running 1 pipeline(s).
tmahmood-microsoft commented 1 year ago

Updated and unhooking the message processor as a part of the transport handler's disconnection detection block.

abhipsaMisra commented 1 year ago

What scenarios did you test for this? Can we add some tests so that we don't regress in the future? For a unit test you could set up a mock client and trigger the disconnection event handler. Then, verify that the message processor handler was unhooked. As a bonus, you can also test that no other operation was executed on the client, i.e. no other handlers were attached or detached.

tmahmood-microsoft commented 1 year ago

/azp run

azure-pipelines[bot] commented 1 year ago
Azure Pipelines successfully started running 1 pipeline(s).
tmahmood-microsoft commented 1 year ago

/azp run

azure-pipelines[bot] commented 1 year ago
Azure Pipelines successfully started running 1 pipeline(s).
tmahmood-microsoft commented 1 year ago

/azp run

azure-pipelines[bot] commented 1 year ago
Azure Pipelines successfully started running 1 pipeline(s).
tmahmood-microsoft commented 1 year ago

/azp run

azure-pipelines[bot] commented 1 year ago
Azure Pipelines successfully started running 1 pipeline(s).
tmahmood-microsoft commented 1 year ago

/azp run

azure-pipelines[bot] commented 1 year ago
Azure Pipelines successfully started running 1 pipeline(s).