-
Notifications
You must be signed in to change notification settings - Fork 492
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
Fix twin desired property payload conversion - MQTT #3322
Fix twin desired property payload conversion - MQTT #3322
Conversation
@@ -1158,7 +1158,7 @@ private void HandleReceivedDesiredPropertiesUpdateRequest(MqttApplicationMessage | |||
// This message is always QoS 0, so no ack will be sent. | |||
receivedEventArgs.AutoAcknowledge = true; | |||
|
|||
Dictionary<string, object> desiredPropertyPatchDictionary = _payloadConvention.GetObject<Dictionary<string, object>>(receivedEventArgs.ApplicationMessage.Payload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was _payloadConvention
null here or something? Why do we want to always use the default payload convention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the payload from service client is always converted using default Payload/Newtonsoft.Json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good then. Leave a comment to that effect here for future reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to adding a comment in here explaining why default convention is used. You could reference the fact that we deserialize this into a dictionary based on service defined convention of it being a utf-8 encoded json string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the payload from service client is always converted using default Payload/Newtonsoft.Json
Not quite. However it was sent from the service client, it is just JSON.
The problem is that our SDK deserializes the twin using Newtonsoft.Json. Then, individual properties can be deserialized to the user's choice, but not until after we've converted them back to bytes using the default payload convention again.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
No description provided.