Description
Currently, supporting PowerShell v3 and v4 creates several challenges for us:
-
To get PSReadLine into the extension, we need changes coming in PSReadLine 2.0, which does not support v3/v4.
-
We are forced to use the v3 AST to support v3, which means:
-
Incompatibility in the APIs between v3, v4 and v5 mean that there are bugs that are hard to fix (and even hard to reproduce, since most of us don't have access to a machine running PowerShell v3 or v4).
-
Of the two CI systems we currently use and the others we are looking to invest in, none supports PowerShell v3/v4 natively.
-
v3/v4 usage is relatively low, and decreasing. With Windows Server 2019 around the corner and Server 2012 mainstream EOL also coming up this year, even more users will be moving to a newer PowerShell version.
-
The code base is fragmented and hard to maintain because:
- We have to compile against .NET Framework 4.5.1 and .NET Standard 1.6, when we would ideally compile against only .NET Standard. (This also spurs us toward better cross platform support)
- We also have compile time PowerShell version targets.
- Both of which lead to crazy .csproj files like this one.
- The .NET Framework/Standard stuff means the backend codebase is riddled with
#ifdef
s. - There are also
#ifdef
s for v3/v4 support. - There's also version conditional logic in the build and run tooling, but that's easier to work with.
This issue contains most of the discussion that's already been had about dropping v3/v4.
My suggestion is:
- Include a deprecation warning for ~6 months, starting when v2.0.0 of the extension is released as stable.
- Actually drop support for v3 and v4 6 months after that date.
- Increment the major version number when we do it.
- Ensure that PSScriptAnalyzer can analyze PowerShell feature support by version so that people can still write scripts for v3 and v4 using the VSCode extension (but with the extension host running v5+).
Some additional things:
An alternative to some of this is to refactor much of our code to abstract away the differences. However, that could be a costly effort and lead to significant regressions.We've also been talking about incrementing the major version of the extension with the addition of PSReadLine support. It seems a little cruel to me to drop v3/v4 support just as we add PSReadLine, but it also makes sense that both changes are big enough to mean a major version increase.
UPDATE
The addition of PSReadLine depends on a new version of PSReadLine that requires PowerShell v5.1 or later. This is by far our biggest motivating factor for ending support for PowerShell v3/v4.