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]: Github Enterprise License API fails when parsing temp license #2903

Open
1 task done
AlexanderBrehm-hps opened this issue Apr 10, 2024 · 1 comment
Open
1 task done
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@AlexanderBrehm-hps
Copy link

What happened?

Hey Team,

I'm getitng this error when attempting to use the Enterprise.License.Get() method in OcktoKit
image

This seems to be because my license is currently a temp one given out by Github/Microsoft with both "unlimited" seats and seats_available
image

I suspect this is then causing the license info class to have issues when attempting to parse the seats and seats_available properties, since those are both strings in my current license as opposed to being the INTs requested by the LicenseInfo object
image

I ended up hacking around it to prove it.
image

I'm not sure if this actually needs to be fixed because most people won't have the evaluation license, but I did want to bring it to your all's attention as it could cause issues for other people and you might want to consider making an update to your code.

Versions

Github Enterprise 3.11.5
Octokit v 10.0.0

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@AlexanderBrehm-hps AlexanderBrehm-hps added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Apr 10, 2024
@AlexanderBrehm-hps
Copy link
Author

Here's the stack trace as well

System.AggregateException: One or more errors occurred. ---> System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1401
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1492
   at Octokit.SimpleJson.DeserializeObject[T](String json, IJsonSerializerStrategy jsonSerializerStrategy) in /_/Octokit/SimpleJson.cs:line 596
   at Octokit.Internal.JsonHttpPipeline.DeserializeResponse[T](IResponse response) in /_/Octokit/Http/JsonHttpPipeline.cs:line 62
   at Octokit.Connection.<Run>d__67`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.ApiConnection.<Get>d__8`1.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Hps.Tools.Management.HPSGithubClient.License_Get() in C:\code\devops\Hps.Tools.Management\Hps.Tools.Management\HPSGithubClient.cs:line 159
---> (Inner Exception #0) System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1401
   at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in /_/Octokit/SimpleJson.cs:line 1492
   at Octokit.SimpleJson.DeserializeObject[T](String json, IJsonSerializerStrategy jsonSerializerStrategy) in /_/Octokit/SimpleJson.cs:line 596
   at Octokit.Internal.JsonHttpPipeline.DeserializeResponse[T](IResponse response) in /_/Octokit/Http/JsonHttpPipeline.cs:line 62
   at Octokit.Connection.<Run>d__67`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.ApiConnection.<Get>d__8`1.MoveNext()<---

@nickfloyd nickfloyd moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Active Apr 11, 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 Apr 15, 2024
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

No branches or pull requests

2 participants