That PR ensures that the workflow keyword results in a parse error. If you build that PR and run it, and try to run the PowerShellGet tests, you get an error when one of the tests tries to install Fabrikam-ServerScript from www.poshtestgallery.com. The error occurs because that script has a workflow defined within it, and that no longer parses, so the installation fails. The error occurs when PowerShellGet tries to get the script info, which requires parsing the script, which won't work in PowerShell 7.
The simple solution to this is for PowerShellGet to check if a script/module has workflow in it before it tries to install it, and prevent that installation from happening with an appropriate error message in PowerShell 6+. Users can still save the script (this does not do any parsing checks), but they won't be able to install such a script, and they'll know why because the error message will tell them the script includes a PowerShell workflow, which is not supported on PowerShell 6 or later.
Steps to reproduce
# Note you need to register www.poshtestgallery.com as a repo and save
# the repo's name in $repoName before you run this command on
# PowerShell 6 or later.
Install-Script Fabrikam-ServerScript -Repository $repoName
Expected behavior
An error message indicating that the script cannot be installed because it contains PowerShell workflow, which is not available in PowerShell 6 or later.
Actual behavior
On PowerShell 6, the script installs.
On PowerShell 7 with the PR code: an error is generated because the script does not parse.
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 7.0.0-preview.2
PSEdition Core
GitCommitId 7.0.0-preview.2-63-g00949ab3522c66bc2efdcb62779d64c7546a5830
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
For reference, see the discussion on PowerShell/PowerShell#10318.
That PR ensures that the
workflow
keyword results in a parse error. If you build that PR and run it, and try to run the PowerShellGet tests, you get an error when one of the tests tries to installFabrikam-ServerScript
fromwww.poshtestgallery.com
. The error occurs because that script has aworkflow
defined within it, and that no longer parses, so the installation fails. The error occurs when PowerShellGet tries to get the script info, which requires parsing the script, which won't work in PowerShell 7.The simple solution to this is for PowerShellGet to check if a script/module has workflow in it before it tries to install it, and prevent that installation from happening with an appropriate error message in
PowerShell 6+
. Users can still save the script (this does not do any parsing checks), but they won't be able to install such a script, and they'll know why because the error message will tell them the script includes a PowerShell workflow, which is not supported on PowerShell 6 or later.Steps to reproduce
Expected behavior
An error message indicating that the script cannot be installed because it contains PowerShell workflow, which is not available in PowerShell 6 or later.
Actual behavior
On PowerShell 6, the script installs.
On PowerShell 7 with the PR code: an error is generated because the script does not parse.
Environment data