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

Fix for ThrowInt32OverflowException in Issue.Events.GetAllForRepository #2037

Closed
wants to merge 1 commit into from

Conversation

terrance00
Copy link

@terrance00 terrance00 commented Oct 24, 2019

Fixes #2031

  • Updated Model with long Id

  • Fixed tests

  • Updated IssuesClient and interface

  • Updated IssuesEventsClient and interface

  • Double checked that the same tests still failing for the same reasons.

 - Updated Model with long Id
 - Fixed tests
 - Updated IssuesClient and interface
 - Updated IssuesEventsClient and interface
@codecov
Copy link

codecov bot commented Oct 24, 2019

Codecov Report

Merging #2037 into master will not change coverage.
The diff coverage is 50%.

@@           Coverage Diff           @@
##           master    #2037   +/-   ##
=======================================
  Coverage   70.73%   70.73%           
=======================================
  Files         537      537           
  Lines       14106    14106           
=======================================
  Hits         9978     9978           
  Misses       4128     4128
Impacted Files Coverage Δ
...t.Reactive/Clients/ObservableIssuesEventsClient.cs 100% <ø> (ø) ⬆️
Octokit/Helpers/ApiUrls.cs 98.62% <ø> (ø) ⬆️
Octokit/Clients/IssuesClient.cs 98.88% <ø> (ø) ⬆️
Octokit/Clients/IssuesEventsClient.cs 100% <ø> (ø) ⬆️
Octokit.Reactive/Clients/ObservableIssuesClient.cs 96.77% <ø> (ø) ⬆️
Octokit/Models/Response/IssueEvent.cs 30.76% <50%> (ø) ⬆️

@shiftkey
Copy link
Member

shiftkey commented Oct 24, 2019

  • Double checked that the same tests still failing for the same reasons.

Which tests was this? And how are they failing?

@shiftkey shiftkey changed the title Fix Issue #2031 Fix ThrowInt32OverflowException in Issue.Events.GetAllForRepository Oct 24, 2019
@shiftkey shiftkey changed the title Fix ThrowInt32OverflowException in Issue.Events.GetAllForRepository Fix for ThrowInt32OverflowException in Issue.Events.GetAllForRepository Oct 24, 2019
@terrance00
Copy link
Author

terrance00 commented Oct 24, 2019

Four instances of:

CanPopulateObjectFromSerializedData

Unless I missed something at Dev startup - but directly from master - the four of those fail.

Also there are some integration tests that fail - but I assumed that there are some environment variables I don't have.

@shiftkey
Copy link
Member

Unless I missed something at Dev startup - but directly from master - the four of those fail.

It's weird because both master and this PR don't seem to have issues with those tests.

These are the usages as I understand it, and I can't spot how the changes relate to your PR:
https://github.com/octokit/octokit.net/search?utf8=%E2%9C%93&q=CanPopulateObjectFromSerializedData&type=

@shiftkey
Copy link
Member

shiftkey commented Oct 24, 2019

Also there are some integration tests that fail - but I assumed that there are some environment variables I don't have.

There's some setup required - https://github.com/octokit/octokit.net/blob/master/CONTRIBUTING.md#slow-tests - but I'm not worried about them for this PR.

@terrance00
Copy link
Author

Yeah it is those four, they do break for me on master as well - without any changes. Any idea what to try?

I get this:

System.Runtime.Serialization.SerializationException : Unable to find assembly 'Octokit, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

@terrance00
Copy link
Author

Seems to be happening in:

Exception thrown: 'System.Runtime.Serialization.SerializationException' in System.Runtime.Serialization.Formatters.dll
Exception thrown: 'System.Reflection.TargetInvocationException' in System.Private.CoreLib.dll

I wonder if it is dotnet core 3 related...

@shiftkey
Copy link
Member

@terrance00 please open a new issue with details about it - we run the tests for netcoreapp2.0 and net452 so I'm curious which is failing for you.

@terrance00
Copy link
Author

Hey man, sorry for the delay.

I have resigned to running the tests in the command line - and that does not fail for those tests.

Leads me to believe that it must be something IDE related in relation the NO_SERIALIZABLE if clause.

Copy link
Member

@shiftkey shiftkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@terrance00 thanks for submitting this PR. I think we can avoid changing the number parameter from an int to a long here as these are for the Issue itself, not the EventInfo number that is being deserialized. This will simplify the diff of changes.

@@ -55,7 +55,7 @@ public interface IObservableIssuesClient
/// <param name="number">The issue number</param>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable<Issue> Get(string owner, string name, int number);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number used in this interface is not the one overflowing. Can we undo the changes in this file to simplify the diff?

@@ -52,7 +52,7 @@ public interface IIssuesClient
/// <param name="number">The issue number</param>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
Task<Issue> Get(string owner, string name, int number);
Task<Issue> Get(string owner, string name, long number);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here - this number used in this interface is not the one overflowing. Can we undo the changes in this file to simplify the diff?

@@ -20,7 +20,7 @@ public interface IObservableIssuesEventsClient
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
IObservable<EventInfo> GetAllForIssue(string owner, string name, int number);
IObservable<EventInfo> GetAllForIssue(string owner, string name, long number);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing for this file - number here is the issue number itself, no the EventInfo number that is being deserialized.

@@ -21,7 +21,7 @@ public interface IIssuesEventsClient
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
Task<IReadOnlyList<EventInfo>> GetAllForIssue(string owner, string name, int number);
Task<IReadOnlyList<EventInfo>> GetAllForIssue(string owner, string name, long number);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing for this file - number here is the issue number itself, no the EventInfo number that is being deserialized.

@shiftkey
Copy link
Member

Thanks for taking a shot at this @terrance00!

I received #2060 which was the minimal fix so this can be closed out, but I hope that you can find time in the future for another contribution.

@shiftkey shiftkey closed this Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ThrowInt32OverflowException on Issue.Events.GetAllForRepository
2 participants