question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Start-PSBootstrap fails on PowerShell 5.1

See original GitHub issue

Prerequisites

Steps to reproduce

Start-PSBootstrap fails on PowerShell 5.1 due to use of unsupported type [System.Management.Automation.SemanticVersion] in build.psm1 therefore it is not possible to build latest versions of PowerShell 7 on PowerShell 5.1 anymore.

Expected behavior

*Start-PSBootstrap* should work on PowerShell 5.1

Actual behavior

*Start-PSBootstrap* throws error on PowerShell 5.1

Error details

Import-Module .\build.psm1
Start-PSBootstrap
Installing PowerShell build dependencies
VERBOSE: Calling Find-Dotnet from Start-PSBootstrap
VERBOSE: In Find-DotNet
ForEach-Object : Unable to find type [System.Management.Automation.SemanticVersion].
At D:\DEVELOPMENT\PowerShellCore\build.psm1:2106 char:81
+ ... *\.\d*)?' | ForEach-Object { [System.Management.Automation.SemanticVe ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Manageme...SemanticVersion:TypeName) [ForEach-Object], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.ForEachObjectCommand

$error[0]|fl * -force


PSMessageDetails      :
Exception             : System.Management.Automation.RuntimeException: Unable to find type [System.Management.Automation.SemanticVersion].
                           at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
                           at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
                           at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1
                        variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
                           at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.<InvokeWithPipe>b__0()
                           at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
                           at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis,
                        Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
                           at System.Management.Automation.ScriptBlock.InvokeUsingCmdlet(Cmdlet contextCmdlet, Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object
                        input, Object scriptThis, Object[] args)
                           at Microsoft.PowerShell.Commands.ForEachObjectCommand.ProcessRecord()
                           at System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject          : System.Management.Automation.SemanticVersion
CategoryInfo          : InvalidOperation: (System.Manageme...SemanticVersion:TypeName) [], RuntimeException
FullyQualifiedErrorId : TypeNotFound
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, D:\DEVELOPMENT\PowerShellCore\build.psm1: line 2106
                        at <ScriptBlock>, D:\DEVELOPMENT\PowerShellCore\build.psm1: line 2106
                        at script:Start-NativeExecution, D:\DEVELOPMENT\PowerShellCore\tools\buildCommon\startNativeExecution.ps1: line 22
                        at Get-LatestInstalledSDK, D:\DEVELOPMENT\PowerShellCore\build.psm1: line 2105
                        at Find-Dotnet, D:\DEVELOPMENT\PowerShellCore\build.psm1: line 2259
                        at Start-PSBootstrap, D:\DEVELOPMENT\PowerShellCore\build.psm1: line 2054
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.1237
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1237
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Visuals

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
iSazonovcommented, Oct 31, 2021

It was too unexpected to find that the module did not work. I personally do not ready to switch completely to pwsh in my work (there are still many places where powershell has no alternative to pwsh).

2reactions
adityapatwardhancommented, Jan 18, 2022

@PowerShell/powershell-maintainers have a consensus that PowerShell 7 is stable enough to be used for development of PowerShell. It would require a lot of effort to ensure Windows PowerShell 5.1 compatibility, which we think is unnecessary. We propose to add #requires -version 7 to build.psm1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug in PowerShell version 5.1.17134.165 $Using: fails ...
The following script fails when used interactively (F8 in ISE or pasted in the console) on Windows 10 1803; $FilePath = "C:\Temp\JobTest2.txt"
Read more >
Updating help for the PSReadLine module in Windows ...
Update-Help still fails in Windows PowerShell 5.1 · Open an elevated powershell.exe session (Run as Administrator). · Run Remove-Module PSReadLine ...
Read more >
Known Issues in WMF 5.1 - PowerShell
Upon installing WMF, if you try to start PowerShell as administrator from the shortcut, you may get an "Unspecified error" message.
Read more >
Error -MIM :incorrect windows powershell version 5.1 ...
I am trying to run powershell script inside workflow in MIM 2016 , but getting below error . "incorrect windows powershell version 5.1...
Read more >
Powershell broke - basic commands not working ...
I was using VS Code on Windows 10 and using PowerShell 5.1. Checked all the environmental variables, everything looks fine.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found