Problem
The GeneralUpdate SDK uses System.Version (Version.TryParse, new Version(string)) for all version comparison logic across Core, Extension, and Drivelution components. System.Version does not support SemVer 2.0 — it rejects prerelease suffixes (e.g. "10.5.0-beta.2") and build metadata, causing either silent "no update needed" (returning false from TryParse) or a FormatException (from new Version()).
Since all NuGet packages are already versioned as 10.5.0-beta.2 (valid SemVer 2.0), this means a client configured with version "10.5.0-beta.2" would never see an update — the comparison silently skips.
Solution
Replace all System.Version usage with a dedicated Semver utility class that follows SemVer 2.0, aligned with the existing implementation in GeneralUpdate.Infrastructure.Common/Utilitys/Semver.cs.
Changes
New files
src/c#/GeneralUpdate.Core/Utilities/Semver.cs — SemVer 2.0 validation, parsing, comparison, normalization
src/c#/GeneralUpdate.Extension/Utilities/Semver.cs — Same, for Extension (netstandard2.0 compatible)
src/c#/GeneralUpdate.Drivelution/Core/Utilities/Semver.cs — Same, for Drivelution
Modified files (Core)
Download/DownloadPlanBuilder.cs — ParseVersion() now returns SemVersion?, all operators use SemVer 2.0 ordering
Strategy/OssStrategy.cs — Replaced new Version() + Version.TryParse with Semver.TryParse
Strategy/ClientStrategy.cs — CheckFail() uses Semver.TryParse
Configuration/UpdateConfiguration.cs — Default ClientVersion from "1.0.0.0" → "1.0.0"
Modified files (Extension)
Compatibility/VersionCompatibilityChecker.cs — All Version.TryParse + </> → Semver.TryParse + SemVersion operators
Modified files (Drivelution)
Core/Utilities/VersionComparer.cs — Marked [Obsolete], delegates to Semver
Tests
CoreTest/Configuration/UpdateConfigurationTests.cs — Assert "1.0.0" instead of "1.0.0.0"
DrivelutionTest/Utilities/VersionComparerAndRestartHelperTests.cs — Updated for aligned Semver
Bugs fixed incidentally
- CVP matching never worked: Old code used
fromVer == localVersion on nullable System.Version (reference type without == overload → always false)
- OssStrategy NPE:
assets.Max()!.Value on an empty parsed-collection would NPE — added guard
Backward compatibility
- Legacy 4-part versions (e.g.
"1.0.0.0") are accepted and normalized to "1.0.0"
HasUpdate() still returns true when version is unparseable ("safe side" policy)
- All existing SemVer 3-part comparisons produce identical results
- Drivelution
VersionComparer is preserved as an [Obsolete] delegate
Breaking changes
- 4-part version fourth segment is discarded (required by SemVer 2.0)
- Drivelution
VersionComparer no longer throws FormatException on invalid input (returns 0 instead)
- Version numbers exceeding
int.MaxValue (~2.1e9) are treated as invalid
Problem
The GeneralUpdate SDK uses
System.Version(Version.TryParse,new Version(string)) for all version comparison logic across Core, Extension, and Drivelution components.System.Versiondoes not support SemVer 2.0 — it rejects prerelease suffixes (e.g."10.5.0-beta.2") and build metadata, causing either silent "no update needed" (returningfalsefromTryParse) or aFormatException(fromnew Version()).Since all NuGet packages are already versioned as
10.5.0-beta.2(valid SemVer 2.0), this means a client configured with version"10.5.0-beta.2"would never see an update — the comparison silently skips.Solution
Replace all
System.Versionusage with a dedicatedSemverutility class that follows SemVer 2.0, aligned with the existing implementation inGeneralUpdate.Infrastructure.Common/Utilitys/Semver.cs.Changes
New files
src/c#/GeneralUpdate.Core/Utilities/Semver.cs— SemVer 2.0 validation, parsing, comparison, normalizationsrc/c#/GeneralUpdate.Extension/Utilities/Semver.cs— Same, for Extension (netstandard2.0 compatible)src/c#/GeneralUpdate.Drivelution/Core/Utilities/Semver.cs— Same, for DrivelutionModified files (Core)
Download/DownloadPlanBuilder.cs—ParseVersion()now returnsSemVersion?, all operators use SemVer 2.0 orderingStrategy/OssStrategy.cs— Replacednew Version()+Version.TryParsewithSemver.TryParseStrategy/ClientStrategy.cs—CheckFail()usesSemver.TryParseConfiguration/UpdateConfiguration.cs— DefaultClientVersionfrom"1.0.0.0"→"1.0.0"Modified files (Extension)
Compatibility/VersionCompatibilityChecker.cs— AllVersion.TryParse+</>→Semver.TryParse+SemVersionoperatorsModified files (Drivelution)
Core/Utilities/VersionComparer.cs— Marked[Obsolete], delegates toSemverTests
CoreTest/Configuration/UpdateConfigurationTests.cs— Assert"1.0.0"instead of"1.0.0.0"DrivelutionTest/Utilities/VersionComparerAndRestartHelperTests.cs— Updated for aligned SemverBugs fixed incidentally
fromVer == localVersionon nullableSystem.Version(reference type without==overload → alwaysfalse)assets.Max()!.Valueon an empty parsed-collection would NPE — added guardBackward compatibility
"1.0.0.0") are accepted and normalized to"1.0.0"HasUpdate()still returnstruewhen version is unparseable ("safe side" policy)VersionCompareris preserved as an[Obsolete]delegateBreaking changes
VersionComparerno longer throwsFormatExceptionon invalid input (returns 0 instead)int.MaxValue(~2.1e9) are treated as invalid