Azure / Azure/azure-iot-sdk-csharp

SDK version :2.0.0-preview007 CreateAsync() Json Error

Open
#3,411 0 comments 0 reactions 0 assignees View on GitHub
bug IoTSDK v2
Dominant language
C#
Stars
477
Forks
492
Avg merge
9h 55m
Merged PRs (30d)
2

Description

### Discussed in https://github.com/Azure/azure-iot-sdk-csharp/discussions/3409

Originally posted by **chandra-rayaprol** December 12, 2023
The method IotHubServiceClient.Devices.CreateAsync(new Device("deviceId");
is throwing an exception:
Newtonsoft.Json.JsonReaderException: Could not convert string to DateTimeOffset: 0001-01-01T00:00:00. Path 'connectionStateUpdatedTime with ...
Could you please help me in resolving this issue?

.NET version 8
Microsoft.Azure.Devices SDK version :2.0.0-preview007

Contributor guide

Open the contributing guide

Research direction

Reproduce IotHubServiceClient.Devices.CreateAsync(new Device("deviceId")) with .NET 8 and Microsoft.Azure.Devices SDK 2.0.0-preview007, then inspect the Newtonsoft.Json.JsonReaderException involving connectionStateUpdatedTime. Done means device creation no longer fails while converting 0001-01-01T00:00:00 to DateTimeOffset.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.