Delubear / GlucoseTray

Tray Icon for displaying current BG information in taskbar.
MIT License
35 stars 21 forks source link

JSON Serializer crash when getting unexpected data from DexcomShare #49

Closed Delubear closed 2 years ago

Delubear commented 3 years ago

Needs investigation, seems to happen randomly and rarely for chunks of time. Could be Dexcom's API going down? Need to most likely log more data. Issue resolves itself after a few minutes usually.

`

Category: GlucoseTrayCore.Services.IGlucoseFetchService EventId: 0 Dexcom fetching failed or received incorrect format. System.Text.Json.JsonException: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0. ---> System.Text.Json.JsonReaderException: '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0. at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes) at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first) at System.Text.Json.Utf8JsonReader.ReadSingleSegment() at System.Text.Json.Utf8JsonReader.Read() at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex) at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadCore[TValue](Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, Type returnType, JsonSerializerOptions options) at GlucoseTrayCore.Services.GlucoseFetchService.GetFetchResultFromDexcom(GlucoseResult fetchResult)

`

Delubear commented 3 years ago

Probably related to #22

Delubear commented 3 years ago

My guess is that we got an error message or error page from DexCom that we were trying to serialize into JSON. That's typically what I see when being told the first character is an invalid < since most of these response start with <!doctype HTML>

Delubear commented 2 years ago

Release 13.0.0 should be taking steps to fix this. DexCom completely changed how they require us to handle our Share authentication, so closing this for now.