ISO 8601 date strings are modified in cloud to device method results #3093
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
If a
DateTimeOffest
formatted as ISO 8601 string is used in aCloudToDeviceMethodResult
then the SDK messes with the date, like removing trailing zeros.Code sample exhibiting the issue
Outputs:
Notice that the trailing zeros are gone. This is problematic when the string is converted back into a
DateTimeOffset
using the same format identifier because aFormatException
is thrown:I think that the problem originates from here, where the response gets deserialized with Newtonsoft.Json:
azure-iot-sdk-csharp/common/src/service/HttpClientHelper.cs
Line 314 in 27685d1
It is a known and unfortunate behavior of Newtonsoft.Json: JamesNK/Newtonsoft.Json#862
In my opinion the SDK should not alter the strings returned from the device methods.
The text was updated successfully, but these errors were encountered: