raid-toolkit / raid-toolkit-sdk

MIT License
41 stars 13 forks source link

StaticDataApi.GetAllData throws unhandled exception #38

Closed svtv closed 3 years ago

svtv commented 3 years ago

Exception is thrown when calling StaticDataApi.GetAllData(). Sample code:

                var client = new RaidToolkitClient();
                client.Connect();
                var staticData = await client.StaticDataApi.GetAllData();
Exception details

``` Newtonsoft.Json.JsonReaderException HResult=0x80131500 Message=Unexpected character encountered while parsing value: �. Path '', line 0, position 0. Source=Newtonsoft.Json StackTrace: at Newtonsoft.Json.JsonTextReader.ParseValue() in /_/Src/Newtonsoft.Json/JsonTextReader.cs:line 1813 at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) in /_/Src/Newtonsoft.Json/JsonReader.cs:line 1235 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) in /_/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:line 155 at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) in /_/Src/Newtonsoft.Json/JsonSerializer.cs:line 904 at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) in /_/Src/Newtonsoft.Json/JsonSerializer.cs:line 883 at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) in /_/Src/Newtonsoft.Json/JsonConvert.cs:line 831 at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) in /_/Src/Newtonsoft.Json/JsonConvert.cs:line 787 at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) in /_/Src/Newtonsoft.Json/JsonConvert.cs:line 720 at Raid.Client.RaidToolkitClient.d__11.MoveNext() in E:\Projects\rsl\raid-toolkit-sdk\SDK\Client\RaidToolkitClient.cs:line 52 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.Tasks.Task.<>c.b__140_1(Object state) at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi) at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state) at System.Threading.QueueUserWorkItemCallback.Execute() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() This exception was originally thrown at this call stack: Newtonsoft.Json.JsonTextReader.ParseValue() in JsonTextReader.cs Newtonsoft.Json.JsonReader.ReadForType(Newtonsoft.Json.Serialization.JsonContract, bool) in JsonReader.cs Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(Newtonsoft.Json.JsonReader, System.Type, bool) in JsonSerializerInternalReader.cs Newtonsoft.Json.JsonSerializer.DeserializeInternal(Newtonsoft.Json.JsonReader, System.Type) in JsonSerializer.cs Newtonsoft.Json.JsonSerializer.Deserialize(Newtonsoft.Json.JsonReader, System.Type) in JsonSerializer.cs Newtonsoft.Json.JsonConvert.DeserializeObject(string, System.Type, Newtonsoft.Json.JsonSerializerSettings) in JsonConvert.cs Newtonsoft.Json.JsonConvert.DeserializeObject(string, Newtonsoft.Json.JsonSerializerSettings) in JsonConvert.cs Newtonsoft.Json.JsonConvert.DeserializeObject(string) in JsonConvert.cs Raid.Client.RaidToolkitClient.Listen() in RaidToolkitClient.cs System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() ... [Call Stack Truncated] ```

Other StaticDataApi methods, when called separately, work well: ```c# var staticData = new StaticData { ArenaData = await client.StaticDataApi.GetArenaData(), ArtifactData = await client.StaticDataApi.GetArtifactData(), HeroData = await client.StaticDataApi.GetHeroData(), LocalizedStrings = await client.StaticDataApi.GetLocalizedStrings(), SkillData = await client.StaticDataApi.GetSkillData(), StageData = await client.StaticDataApi.GetStageData() }; ```

dnchattan commented 3 years ago

found the issue. looks like it was caused by the buffer size being too small for the full set of data. increased the size and it should work now

dnchattan commented 3 years ago

(you'll need to grab the latest Raid.Client nuget package once it finishes publishing to get the fix)

svtv commented 3 years ago

Great, thanks a lot