Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

int32 overflow deserializing generated models #95

Closed
martincostello opened this issue Jul 3, 2024 · 4 comments
Closed

int32 overflow deserializing generated models #95

martincostello opened this issue Jul 3, 2024 · 4 comments

Comments

@martincostello
Copy link
Contributor

          Looks like this also affects the new .NET SDK too:
System.Text.Json.JsonException
  HResult=0x80131500
  Message=The JSON value could not be converted to System.Int32. Path: $ | LineNumber: 0 | BytePositionInLine: 10.
  Source=System.Text.Json
  StackTrace:
   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 Microsoft.Kiota.Serialization.Json.JsonParseNode.GetIntValue()
   at GitHub.Models.EnvironmentObject.<GetFieldDeserializers>b__42_3(IParseNode n)
   at Microsoft.Kiota.Serialization.Json.JsonParseNode.AssignFieldValues[T](T item)
   at Microsoft.Kiota.Serialization.Json.JsonParseNode.GetObjectValue[T](ParsableFactory`1 factory)
   at Microsoft.Kiota.Serialization.Json.JsonParseNode.<GetCollectionOfObjectValues>d__19`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at GitHub.Repos.Item.Item.Environments.EnvironmentsGetResponse.<GetFieldDeserializers>b__14_0(IParseNode n)
   at Microsoft.Kiota.Serialization.Json.JsonParseNode.AssignFieldValues[T](T item)
   at Microsoft.Kiota.Serialization.Json.JsonParseNode.GetObjectValue[T](ParsableFactory`1 factory)
   at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.<SendAsync>d__20`1.MoveNext()
   at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.<SendAsync>d__20`1.MoveNext()
   at GitHub.Repos.Item.Item.Environments.EnvironmentsRequestBuilder.<GetAsync>d__4.MoveNext()

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
FormatException: Either the JSON value is not in a supported format, or is out of bounds for an Int32.

Originally posted by @martincostello in octokit/octokit.net#2893 (comment)

Copy link

github-actions bot commented Jul 3, 2024

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@martincostello
Copy link
Contributor Author

I'm still seeing this with 0.0.20 of GitHub.Octokit.SDK. Have created a new issue here as the original issue is resolved.

@kfcampbell
Copy link
Member

Thanks for reporting! This should be fixed as of v0.0.21. Please let us know if you run into any cases where this isn't true! I'm going to close this issue for now, though please don't hesitate to report future occurrences.

@github-project-automation github-project-automation bot moved this from 🆕 Triage to ✅ Done in 🧰 Octokit Active Jul 3, 2024
@martincostello
Copy link
Contributor Author

@kfcampbell Sorry, it's still broken. Looks like the exact property I have an issue with escaped the changes:

public int? Id { get; set; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants