I am using the C# wrapper HaloEzAPI made by Gitch100.
When I make a call using GetCustomPostGameCarnageReport I get the following error message. It wasnt happen two days ago and just suddenly started.
It says the error occurs on line 56 below.
If anyone could help me with this it would be appreciated greatly.
> Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
> Parameter name: millisecondsTimeoutDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
>
> Exception Details: System.ArgumentOutOfRangeException: Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
> Parameter name: millisecondsTimeout
>
> Source Error:
>
> Line 54: if (results.Id.MatchId != null)
> Line 55: {
> Line 56: var carnageReports = await _service.GetCustomPostGameCarnageReport(results.Id.MatchId);
> Line 57: var carnageTeam = carnageReports.PlayerStats.Where(x => x.TeamId == results.Players.FirstOrDefault().TeamId).OrderBy(x => x.Player.Gamertag).Select(x => x.Player.Gamertag).ToArray(); Line 58:
I also get this error occasionally
> JSON integer 4294967295 is too large or small for an Int32. Path ‘TeamStats[0].Score’, line 1, position 2413.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
>
> Exception Details: Newtonsoft.Json.JsonReaderException: JSON integer 4294967295 is too large or small for an Int32. Path ‘TeamStats[0].Score’, line 1, position 2413.
>
> Source Error:
>
> Line 54: if (results.Id.MatchId != null)
> Line 55: {
> Line 56: var carnageReports = await _service.GetCustomPostGameCarnageReport(results.Id.MatchId);
If Stopwatch.Elapsed.Seconds >= SecondsLimit than the following equation ‘(SecondsLimit - seconds) * 1000’ results in a negative number. i.e. (10 - 11) * 1000 = **-**1000.
You can’t sleep for a negative amount of time.
Bug #2: TeamStat Model
TeamStat.Score should be an int, but the API currently returns an unsigned int. The HaloEzAPI wrapper model has the property as an int, so when an unsigned int that’s too large for an int comes through, it explodes.
There’s a bug, but whose?
On one hand, the API shouldn’t be returning an unsigned int because score can be negative. On the other, the API currently does return an unsigned in, so the model should represent this.
Seriously dude thank you so much for the reply. I installed it using the NuGet manager so does that mean I have to wait for glitch to update to a uInt? Or should I just download the source and include it in my project?
> 2533274813694625;3:
> > 2753093343646559;2:
> > TeamStat.Score should be an int, but the API currently returns an unsigned int. The HaloEzAPI wrapper model has the property as an int, so when an unsigned int that’s too large for an int comes through, it explodes.
> >
> > There’s a bug, but whose?
> >
> > On one hand, the API shouldn’t be returning an unsigned int because score can be negative. On the other, the API currently does return an unsigned in, so the model should represent this.
> >
> > https://github.com/glitch100/Halo-API/blob/master/HaloEzAPI/Model/Response/Stats/TeamStat.cs#L8
> >
> > vs.
> >
> > https://github.com/gitFurious/HaloSharp/blob/master/Source/HaloSharp/Model/Stats/CarnageReport/Common/TeamStat.cs#L12
>
>
> Seriously dude thank you so much for the reply. I installed it using the NuGet manager so does that mean I have to wait for glitch to update to a uInt? Or should I just download the source and include it in my project?
>
> Again thanks for the reply!
I did a quick edit to explain the other bug too.
Yeah, these are both bug in the wrapper.
I see your options as the following:
Submit an issue on GitHub and see if glitch will do an fix. Wait for the fix + a new NuGet package.
Download the source, fix it yourself, and start using it.
Fork the repository, fix it yourself, and submit a pull request with the fixes for glitch to include. Wait for the fix to be included + a new NuGet package.Number 3 is the friendly thing to do but whatever you choose, you should at least submit an issue so that they are aware.
> 2753093343646559;4:
> > 2533274813694625;3:
> > > 2753093343646559;2:
> > > TeamStat.Score should be an int, but the API currently returns an unsigned int. The HaloEzAPI wrapper model has the property as an int, so when an unsigned int that’s too large for an int comes through, it explodes.
> > >
> > > There’s a bug, but whose?
> > >
> > > On one hand, the API shouldn’t be returning an unsigned int because score can be negative. On the other, the API currently does return an unsigned in, so the model should represent this.
> > >
> > > https://github.com/glitch100/Halo-API/blob/master/HaloEzAPI/Model/Response/Stats/TeamStat.cs#L8
> > >
> > > vs.
> > >
> > > https://github.com/gitFurious/HaloSharp/blob/master/Source/HaloSharp/Model/Stats/CarnageReport/Common/TeamStat.cs#L12
> >
> >
> > Seriously dude thank you so much for the reply. I installed it using the NuGet manager so does that mean I have to wait for glitch to update to a uInt? Or should I just download the source and include it in my project?
> >
> > Again thanks for the reply!
>
>
> I did a quick edit to explain the other bug too.
>
> Yeah, these are both bug in the wrapper.
>
> I see your options as the following:
>
> - Submit an issue on GitHub and see if glitch will do an fix. Wait for the fix + a new NuGet package.
> - Download the source, fix it yourself, and start using it.
> - Fork the repository, fix it yourself, and submit a pull request with the fixes for glitch to include. Wait for the fix to be included + a new NuGet package.
> Number 3 is the friendly thing to do but whatever you choose, you should at least submit an issue so that they are aware.
Thanks again for the quick reply. You sir are a legend!