dotnet / docker-tools

This is a repo to house some common tools for our various docker repos.
MIT License
122 stars 46 forks source link

Overflow exception when posting issue to GitHub with OctoKit #1322

Closed mthalman closed 3 months ago

mthalman commented 3 months ago
Unhandled exception: System.OverflowException: Value was either too large or too small for an Int32.
   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.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.Post[T](Uri uri, Object data, String accepts, String contentType, CancellationToken cancellationToken)
   at Microsoft.DotNet.Git.IssueManager.Clients.GitHubClient.CreateNewIssueCommentAsync(String repositoryUrl, Int32 issueNumber, String comment, String personalAccessToken) in /_/src/Microsoft.DotNet.Git.IssueManager/src/Clients/GitHubClient.cs:line 87
   at Microsoft.DotNet.Git.IssueManager.Helpers.RepositoryHelper.CreateNewIssueCommentAsync(String repositoryUrl, Int32 issueNumber, String comment, String gitHubPersonalAccessToken) in /_/src/Microsoft.DotNet.Git.IssueManager/src/Helpers/RepositoryHelper.cs:line 91
   at Microsoft.DotNet.Git.IssueManager.IssueManager.CreateNewIssueCommentAsync(String repositoryUrl, Int32 issueNumber, String comment) in /_/src/Microsoft.DotNet.Git.IssueManager/src/IssueManager.cs:line 84
   at Microsoft.DotNet.ImageBuilder.NotificationService.PostAsync(String title, String description, IEnumerable`1 labels, String repoUrl, String gitHubAccessToken, Boolean isDryRun, IEnumerable`1 comments) in /image-builder/src/NotificationService.cs:line 46
   at Microsoft.DotNet.ImageBuilder.Commands.PostPublishNotificationCommand.ExecuteAsync() in /image-builder/src/Commands/PostPublishNotificationCommand.cs:line 101

Example build (internal link)

lbussell commented 3 months ago

Comment ids have now apparently overflowed the same way as issue ids did in the past: https://github.com/octokit/octokit.net/issues/2927

lbussell commented 3 months ago

I also checked our code for use of OctoKit. We use it, but we use the implicit version from Microsoft.DotNet.Git.IssueManager. Since we use all 3 of Microsoft.DotNet.Git.IssueManager, Microsoft.DotNet.VersionTools.Automation.GitHubApi, and Octokit directly, I'm going to file a separate issue to consolidate all of that usage to just one of those packages (probably OctoKit).