Skip to content

Invoke-RestMethod started to fail in v6-beta.9 on a Windows 7 machine #5242

Closed
@nightroman

Description

@nightroman
  • This issue happens on a Windows 7 machine. All works fine on Windows 8.1 and 10.
  • This issue is new in v6-beta.9. All was fine in previous betas and is fine in v5.

Problem case:

Invoke-RestMethod https://api.github.com/users/nightroman/repos

Expected result:

The command returns the requested data.

Actual result:

The command fails:

Invoke-RestMethod : Version string portion was too short or too long.
At line:1 char:1
+ Invoke-RestMethod https://api.github.com/users/nightroman/repos
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-RestMethod], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Some info about the inner exception:

PS> $error.Exception.ToString()
System.ArgumentException: Version string portion was too short or too long.
   at System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument)
   at System.Version.TryParseVersion(String version, VersionResult& result)
   at System.Version.Parse(String input)
   at System.Version..ctor(String version)
   at Microsoft.PowerShell.Commands.PSUserAgent.get_PlatformName()
   at Microsoft.PowerShell.Commands.PSUserAgent.get_UserAgent()
   at Microsoft.PowerShell.Commands.WebRequestSession..ctor()
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.PrepareSession()
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
   at System.Management.Automation.Cmdlet.DoProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()

Environment:

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-beta.9
PSEdition                      Core
GitCommitId                    v6.0.0-beta.9
OS                             Microsoft Windows 6.1.7601 S
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions