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

ThrowInt32OverflowException on Issue.Events.GetAllForRepository #2031

Closed
Thraka opened this issue Oct 17, 2019 · 6 comments
Closed

ThrowInt32OverflowException on Issue.Events.GetAllForRepository #2031

Thraka opened this issue Oct 17, 2019 · 6 comments
Assignees
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone

Comments

@Thraka
Copy link

Thraka commented Oct 17, 2019

Using octokit 0.36.0

The following code causes an exception:

var results = await client.Issue.Events.GetAllForRepository("dotnet", "docs");
This exception was originally thrown at this call stack:
	System.Convert.ThrowInt32OverflowException()
	System.Convert.ToInt32(long)
	long.System.IConvertible.ToInt32(System.IFormatProvider)
	System.Convert.ChangeType(object, System.Type, System.IFormatProvider)
	Octokit.PocoJsonSerializerStrategy.DeserializeObject(object, System.Type) in SimpleJson.cs
	Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(object, System.Type) in SimpleJsonSerializer.cs
	Octokit.PocoJsonSerializerStrategy.DeserializeObject(object, System.Type) in SimpleJson.cs
	Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(object, System.Type) in SimpleJsonSerializer.cs
	Octokit.PocoJsonSerializerStrategy.DeserializeObject(object, System.Type) in SimpleJson.cs
	Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(object, System.Type) in SimpleJsonSerializer.cs
	...
	[Call Stack Truncated]
@shiftkey
Copy link
Member

This is the problem property:

/// <summary>
/// The id of the issue/pull request event.
/// </summary>
public int Id { get; protected set; }

And much like we did in #1940, changing it to a long should fix the issue.

@terrance00
Copy link

I'd like to contribute, forked.

@terrance00
Copy link

Hi @shiftkey, I've got a question.

When we change that model from int to long for the Id, some tests break:

    //IssueEventsClientTests.cs
    var issueEvents = await _issuesEventsClient.GetAllForRepository(_context.Repository.Id);
    int issueEventId = issueEvents[0].Id;

This does then also break those interfaces it calls.

Shall I follow the chain down and change the interfaces and implementations to accept longs etc.?

Let me know - I'll create a PR by following the chain all the way for the longs.

@shiftkey
Copy link
Member

Shall I follow the chain down and change the interfaces and implementations to accept longs etc.?

Yeah, we're gonna have to break those cases too.

terrance00 added a commit to terrance00/octokit.net that referenced this issue Oct 24, 2019
 - Updated Model with long Id
 - Fixed tests
 - Updated IssuesClient and interface
 - Updated IssuesEventsClient and interface
@mijacobs
Copy link

I'm running into this issue as well, is there an ETA for a fix?

@shiftkey
Copy link
Member

shiftkey commented Feb 9, 2020

Closing this out as I believe this has been fixed in #2060 and is now available on NuGet.

@shiftkey shiftkey closed this as completed Feb 9, 2020
@nickfloyd nickfloyd added Status: Up for grabs Issues that are ready to be worked on by anyone and removed up-for-grabs labels Oct 27, 2022
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants