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

Fix bug in date deserialization of device method response #3097

Merged
merged 5 commits into from Feb 6, 2023

Conversation

brycewang-microsoft
Copy link
Contributor

For #3093,

Newtonsoft.Json has a known issue where date serialization/deserialization drops trailing zeros in the microseconds date portion by default. As a result, a method payload containing date type will be deserialized into an improperly formatted ISO 8601 string and cannot be parsed correctly.

{"MyIso8601Date":"2023-01-31T01:37:08.45994-08:00"}

Unhandled exception. System.FormatException: String '2023-01-31T01:37:08.45994-08:00' was not recognized as a valid DateTime.
   at System.DateTimeParse.ParseExact(ReadOnlySpan`1 s, ReadOnlySpan`1 format, DateTimeFormatInfo dtfi, DateTimeStyles style, TimeSpan& offset)
   at System.DateTimeOffset.ParseExact(String input, String format, IFormatProvider formatProvider, DateTimeStyles styles)

@brycewang-microsoft
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@brycewang-microsoft
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@brycewang-microsoft
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants