-
Notifications
You must be signed in to change notification settings - Fork 652
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
System.OverflowException for ParseInt32[Bug] #2390
Comments
A pull request fixing this would be warmly welcomed! |
replicated error, there should be some safeguard when numbers in tag overflow integer, or perhaps the tag should be excluded as does not meet version tag criteria |
@quasarea, sounds like you're on to something here. Are you able to reproduce the error in a test in a pull request? |
sure, I missed out condition in my pipeline and each commit now gets tagged with semver at the end of pipeline. during first build the tag 5.2.14 was found on main branch, gitversion came up with 5.2.14-PullRequest21890.5 and pipeline added this as a tag during next build the tag 5.2.14-PullRequest21890.5 was found, gitversion came up with 5.2.14-PullRequest2189021890 and pipeline added this as a tag during next build the tag 5.2.14-PullRequest2189021890 was found and calculation of new version thrown int overflow |
@quasarea @asbjornu - I hit this issue last week. We are moving over to gitversion, but the existing build process tagged branches with a timestamp value. To work around this we either add the tag-prefix config or remove those tags on the locally checked out repo before running gitversion. I created a PR for your first suggestion (add a try catch around the SemVer creation to catch overflow/formatting errors) If this seems sensible happy to add tests and tidy up as per feedback. TestingCreated a local repo with a dummy commit. Output
|
I think we should be able to increase this to |
🎉 This issue has been resolved in version 5.8.3 🎉 Your GitReleaseManager bot 📦🚀 |
Describe the bug
When gitversion tries to parse a prerelease tag followed by a 10+ digit number an exception is thrown.
Expected Behavior
Gitversion should catch the exception and handle it some other way
Actual Behavior
Gitversion doesn't handle any exceptions inside a method called TryParse
Possible Fix
Make TryParse method of
GitVersionCore/VersionCalculation/SemanticVersioning/SemanticVersion.cs
actually use a try-catch as the name would suggest.Alternatively have
GitVersionCore/VersionCalculation/SemanticVersioning/SemanticVersionPreReleaseTag.cs
Parse method use a TryParse for parsing the IntSteps to Reproduce
Use a tag with a long number in it. Ours has been automated.
Here's the exception along with the tag that likely caused the issue:
Context
Our CI build pipeline fails and we are unable to rebuild
Your Environment
Azure DevOps Task. Gitversion is 5.01 there, however this issue is also present in more recent versions.
The text was updated successfully, but these errors were encountered: