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

[BUG]: Int32 overflow for Github object ids #2893

Open
1 task done
Apolloluy opened this issue Mar 5, 2024 · 8 comments
Open
1 task done

[BUG]: Int32 overflow for Github object ids #2893

Apolloluy opened this issue Mar 5, 2024 · 8 comments
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@Apolloluy
Copy link

Apolloluy commented Mar 5, 2024

What happened?

Running

var envs = await github.Repository.Environment.GetAll(owner, "API_CICD");

Returns
image

System.OverflowException: 'Value was either too large or too small for an Int32.'
When attempting to parse the Github.id field in the response.

Versions

Octokit.nupkg 10.0.0 (.net)
image

Relevant log output

System.OverflowException
  HResult=0x80131516
  Message=Value was either too large or too small for an Int32.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Convert.ThrowInt32OverflowException()

Value = 2398648970
{
			"id": 2398648970,
			"node_id": "EN_kwDOJhYfOc6O-HqK",
			"name": "test",
			"url": "https://api.github.com/repos/ContextureHIE/API_CICD/environments/test",
			"html_url": "https://github.com/ContextureHIE/API_CICD/deployments/activity_log?environments_filter=test",
			"created_at": "2024-03-01T22:23:36Z",
			"updated_at": "2024-03-01T22:23:36Z",
			"can_admins_bypass": true,
			"protection_rules": [
				{
					"id": 16441898,
					"node_id": "GA_kwDOJhYfOc4A-uIq",
					"type": "required_reviewers",
					"prevent_self_review": false,
					"reviewers": [
						{
							"type": "User",
							"reviewer": {
								"login": "Apolloluy",
								"id": 44653204,
								"node_id": "MDQ6VXNlcjQ0NjUzMjA0",
								"avatar_url": "https://avatars.githubusercontent.com/u/44653204?v=4",
								"gravatar_id": "",
								"url": "https://api.github.com/users/Apolloluy",
								"html_url": "https://github.com/Apolloluy",
								"followers_url": "https://api.github.com/users/Apolloluy/followers",
								"following_url": "https://api.github.com/users/Apolloluy/following{/other_user}",
								"gists_url": "https://api.github.com/users/Apolloluy/gists{/gist_id}",
								"starred_url": "https://api.github.com/users/Apolloluy/starred{/owner}{/repo}",
								"subscriptions_url": "https://api.github.com/users/Apolloluy/subscriptions",
								"organizations_url": "https://api.github.com/users/Apolloluy/orgs",
								"repos_url": "https://api.github.com/users/Apolloluy/repos",
								"events_url": "https://api.github.com/users/Apolloluy/events{/privacy}",
								"received_events_url": "https://api.github.com/users/Apolloluy/received_events",
								"type": "User",
								"site_admin": false
							}
						}
					]
				}
			],
			"deployment_branch_policy": null
		}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Apolloluy Apolloluy added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Mar 5, 2024
@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone and removed Status: Triage This is being looked at and prioritized labels Mar 5, 2024
@jeffhandley
Copy link

Since this seems to repro using 10.0.0, it must be separate from #2889, which was fixed with #2890.

@kartheekp-ms
Copy link

kartheekp-ms commented May 13, 2024

Upgrading the octokit package version to 11.0.1 fixed the issue for me. https://www.nuget.org/packages/Octokit/11.0.1

kartheekp-ms referenced this issue in NuGet/Entropy May 15, 2024
@martincostello
Copy link
Contributor

I can still repro this with 11.0.1 for deployment environments. I have one with an ID of 2296494046 which overflows the Id property as it's still an int:

/// <summary>
/// Id of this deployment environment
/// </summary>
public int Id { get; private set; }

@martincostello
Copy link
Contributor

I would do a PR to fix it, but fixing it properly is a lottttttttt of breaking changes.

@wesProg23
Copy link

wesProg23 commented Jun 6, 2024

I still getting the error on version 11.0.1
When i call

await client.Issue.Comment.GetAllForIssue("myOrganization", "MyRepository", 195325)

or

await client.Issue.Comment.Create("myOrganization", "MyRepository", 195325, "Some Comment");
500 -    at System.Convert.ThrowInt32OverflowException()
   at System.Convert.ToInt32(Int64 value)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1437
   at Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/Http/SimpleJsonSerializer.cs:line 205
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1492
   at Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/Http/SimpleJsonSerializer.cs:line 205
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1519
   at Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/Http/SimpleJsonSerializer.cs:line 205
   at Octokit.SimpleJson.DeserializeObject(String json, Type type, IJsonSerializerStrategy jsonSerializerStrategy) in /_/Octokit/SimpleJson.cs:line 584
   at Octokit.SimpleJson.DeserializeObject[T](String json, IJsonSerializerStrategy jsonSerializerStrategy) in /_/Octokit/SimpleJson.cs:line 596
   at Octokit.Internal.SimpleJsonSerializer.Deserialize[T](String json) in /_/Octokit/Http/SimpleJsonSerializer.cs:line 22
   at Octokit.Internal.JsonHttpPipeline.DeserializeResponse[T](IResponse response) in /_/Octokit/Http/JsonHttpPipeline.cs:line 44
   at Octokit.Connection.Run[T](IRequest request, CancellationToken cancellationToken, Func`2 preprocessResponseBody) in /_/Octokit/Http/Connection.cs:line 752
   at Octokit.ApiConnection.GetPage[TU](Uri uri, IDictionary`2 parameters, String accepts, ApiOptions options, Func`2 preprocessResponseBody)
   at Octokit.ApiConnection.<>c__DisplayClass20_0`1.<<GetAll>b__0>d.MoveNext() in /_/Octokit/Http/ApiConnection.cs:line 240
--- End of stack trace from previous location ---
   at Octokit.ApiPagination.GetAllPages[T](Func`1 getFirstPage, Uri uri) in /_/Octokit/Clients/ApiPagination.cs:line 23\

@Eilon
Copy link
Contributor

Eilon commented Jun 6, 2024

Also having the issue here with 11.0.1.

We're calling gitHub.Issue.Comment.GetAllForIssue(owner, repo, number)

And for dotnet/maui#18618 we get the exception 'Value was either too large or too small for an Int32'

But dotnet/maui#22580 and dotnet/maui#20012 work fine.

@0x5bfa
Copy link

0x5bfa commented Jun 7, 2024

Also I'm getting this issue in 11.0.1

Calling Activity.Events.GetAllUserReceived().

   at System.Convert.ThrowInt32OverflowException()
   at System.Convert.ToInt32(Int64 value)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1437
   at Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/Http/SimpleJsonSerializer.cs:line 205
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1492
   at Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/Http/SimpleJsonSerializer.cs:line 205
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1492
   at Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/Http/SimpleJsonSerializer.cs:line 190
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1492
   at Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/Http/SimpleJsonSerializer.cs:line 205
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1519
   at Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/Http/SimpleJsonSerializer.cs:line 205
   at Octokit.SimpleJson.DeserializeObject(String json, Type type, IJsonSerializerStrategy jsonSerializerStrategy) in /_/Octokit/SimpleJson.cs:line 584
   at Octokit.SimpleJson.DeserializeObject[T](String json, IJsonSerializerStrategy jsonSerializerStrategy) in /_/Octokit/SimpleJson.cs:line 596
   at Octokit.Internal.SimpleJsonSerializer.Deserialize[T](String json) in /_/Octokit/Http/SimpleJsonSerializer.cs:line 22
   at Octokit.Internal.JsonHttpPipeline.DeserializeResponse[T](IResponse response) in /_/Octokit/Http/JsonHttpPipeline.cs:line 44
   at Octokit.Connection.Run[T](IRequest request, CancellationToken cancellationToken, Func`2 preprocessResponseBody) in /_/Octokit/Http/Connection.cs:line 752
   at Octokit.ApiConnection.GetPage[TU](Uri uri, IDictionary`2 parameters, String accepts, ApiOptions options, Func`2 preprocessResponseBody)
   at Octokit.ApiConnection.<>c__DisplayClass20_0`1.<<GetAll>b__0>d.MoveNext() in /_/Octokit/Http/ApiConnection.cs:line 240
--- End of stack trace from previous location ---
   at Octokit.ApiPagination.GetAllPages[T](Func`1 getFirstPage, Uri uri) in /_/Octokit/Clients/ApiPagination.cs:line 23
   at FluentHub.Octokit.Queries.Users.ActivityQueries.GetAllAsync(String login)
   at FluentHub.App.ViewModels.Viewers.DashBoardViewModel.LoadHomeContentsAsync()
   at FluentHub.App.ViewModels.Viewers.DashBoardViewModel.LoadUserHomePageAsync()

@naefp
Copy link

naefp commented Jun 8, 2024

bump. 👍🏼
same here, in my case at IssueComment in 11.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
Status: 🔥 Backlog
Development

Successfully merging a pull request may close this issue.

9 participants