semver icon indicating copy to clipboard operation
semver copied to clipboard

System.OverflowException: 'Prerelease identifier 'xxx' was too large for Int32 in version 'xxx'.'

Open specialforest opened this issue 3 years ago • 1 comments
trafficstars

An example version: "1.0.0-202208281200". I don't see the spec limits pre-release numeric parts to 2^31 range.

specialforest avatar Sep 02 '22 16:09 specialforest

The semver spec does not give an upper limit to numeric prerelease identifiers nor for the major, minor, or patch. However, for ease of developer use int was used for these. It was thought unlikely people would run into those limits. For v3.0 of the library, we can consider using long or BigInteger.

In the mean time, I would suggest turning it into an alphanumeric prerelease identifier following the ISO 8601 standard (e.g. 1.0.0-2022-08-28.1200) or dot separating each of the parts (e.g. 1.0.0-2022.08.28.1200)

WalkerCodeRanger avatar Sep 03 '22 19:09 WalkerCodeRanger

The semver spec does not give an upper limit to numeric prerelease identifiers nor for the major, minor, or patch.

Yeah, I am encountering the same issue with the patch number. I would definitely be interested in a fix.

damepatr avatar Jan 04 '23 14:01 damepatr

@damepatr To help me understand the use case and how to best address it, how are you getting patch numbers so high? Also, what is the highest patch number you would anticipate needing?

WalkerCodeRanger avatar Jan 06 '23 07:01 WalkerCodeRanger

@WalkerCodeRanger

To help me understand the use case and how to best address it, how are you getting patch numbers so high?

I used the date and time to create a patch number similar to the following: 1.1.20221227164407.

I know that this probably isn't a best practice. I was just testing some of my own code and I noticed that SemVersion.TryParse was returning false when this technically is valid SemVer.

damepatr avatar Jan 18 '23 00:01 damepatr

Also, what is the highest patch number you would anticipate needing?

At the moment, I'm not certain. I may not need a larger patch number.

damepatr avatar Jan 18 '23 00:01 damepatr

A preview of this feature has been released in the 3.0.0-beta.0 version available on NuGet.

WalkerCodeRanger avatar May 07 '23 07:05 WalkerCodeRanger

This has been fixed on master and will be included in v3.0.0

WalkerCodeRanger avatar Aug 20 '23 19:08 WalkerCodeRanger