crowdin / crowdin-api-client-dotnet

.NET client library for Crowdin API
https://www.nuget.org/packages/Crowdin.Api/
MIT License
52 stars 27 forks source link

An exception occurs when Crowdin.Api.Storage.StorageApiExecutor.AddStorage is called. #250

Closed BenKeyFSI closed 4 months ago

BenKeyFSI commented 4 months ago

An exception occurs when Crowdin.Api.Storage.StorageApiExecutor.AddStorage is called. The exception is as follows.

Newtonsoft.Json.JsonReaderException
  HResult=0x80131500
  Message=JSON integer 2178162005 is too large or small for an Int32. Path 'id', line 2, position 18.
  Source=Newtonsoft.Json
  StackTrace:
   at Newtonsoft.Json.JsonTextReader.ParseReadNumber(ReadType readType, Char firstChar, Int32 initialPosition)
   at Newtonsoft.Json.JsonTextReader.ReadNumberValue(ReadType readType)
   at Newtonsoft.Json.JsonTextReader.ReadAsInt32()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Crowdin.Api.Core.JsonParser.ParseResponseObject[TData](JObject rootElement)
   at Crowdin.Api.Storage.StorageApiExecutor.<AddStorage>d__6.MoveNext()
   at MessageCenterAPI.Extensions.CrowdinApiExtensions.<AddStorage>d__3.MoveNext() in ...\shared\MessageCenter\main\source\MessageCenterAPI\Extensions\CrowdinApiExtensions.cs:line 31

  This exception was originally thrown at this call stack:

    [External Code]

    MessageCenterAPI.Extensions.CrowdinApiExtensions.AddStorage(Crowdin.Api.ICrowdinApiClient, string, string) in CrowdinApiExtensions.cs
andrii-bodnar commented 4 months ago

Hi @BenKeyFSI, please make sure you are using the latest version of the API client - 2.24.0.

We have recently fixed issues with the Storage ID type: #240, #242.

BenKeyFSI commented 4 months ago

@andrii-bodnar Thanks. I checked for an updated NuGet package but the NuGet package manager in Visual Studio 2022 did not show the update for some reason. However, when I manually updated the PackageReference in the project file it worked and now the bug is fixed.