Skip to content

System.Management.Automation.SemanticVersion should support more string constructors #1618

@JamesWTruher

Description

@JamesWTruher

Steps to reproduce

if ( $psversiontable.psversion -gt "5.0" ) {
  "yay"
}

Expected behavior

yay

Actual behavior

Could not compare "6.0.0-alpha" to "5.0". Error: "Cannot convert value "5.0" to type "System.Management.Automation.SemanticVersion". Error: "Cannot process argument
because the value of argument "version" is not valid. Change the value of the "version" argument and run the operation again.""
At line:1 char:6
+ if ( $psversiontable.psversion -gt "5.0" ) {
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : ComparisonFailure

Environment data

PS /tmp> $psversiontable

Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      PowerShellCore
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.7-193-g8f60d488cb4942243d697249c6948d28c56587c7-dirty
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Metadata

Metadata

Assignees

Labels

Resolution-FixedThe issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtime

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions