MingweiSamuel / Camille

C# Riot API Library. Thread safe, automatic retries, autogenerated nightly releases.
Other
102 stars 8 forks source link

Issue with Json values not converting (LolGameApi schema out of date) #51

Open l-404-l opened 3 years ago

l-404-l commented 3 years ago
System.AggregateException: One or more errors occurred. (The JSON value could not be converted to System.Nullable`1[System.Int32]. Path: $.activePlayer.currentGold | LineNumber: 69 | BytePositionInLine: 34.)
 ---> System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable`1[System.Int32]. Path: $.activePlayer.currentGold | LineNumber: 69 | BytePositionInLine: 34.
 ---> System.FormatException: Either the JSON value is not in a supported format, or is out of bounds for an Int32.
   at System.Text.Json.Utf8JsonReader.GetInt32()
   at Camille.Core.JsonHandler.CustomIntConverter.Read(Utf8JsonReader& reader, Type type, JsonSerializerOptions options)
   at System.Text.Json.Serialization.Converters.NullableConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
   at System.Text.Json.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   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, Utf8JsonReader& reader, Exception ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, 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 System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at Camille.Core.JsonHandler.Deserialize[T](String content)
   at Camille.LolGame.LolGameApi.Send[T](HttpRequestMessage request, Nullable`1 token)
MingweiSamuel commented 3 years ago

Do you know which endpoint you were calling when this happened? Seems likely an out-of-range int32

l-404-l commented 3 years ago

CurrentPlayer I believe it was

l-404-l commented 3 years ago

seems Camille.Lcu.LolChampSelect.ChampSelectSession is also having issues deserializing found changing actions fixes it. Changed it to [JsonPropertyName("actions")] public List<List<IDictionary<string,object>>>? Actions { get; set; } seems the be the format now

MingweiSamuel commented 3 years ago

Both the LCU and LolGameApi schemas are no longer up to date, I'll have to fix the job which pulls the LCU one, and write a new one for the LolGameApi, not sure when I'll have a chance to