Skip to content

$PSVersionTable.CLRVersion property should be removed in PowerShell Core #1395

Closed

Description

Steps to reproduce

I'm on Windows 10 with November update:

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.0.10586.122
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.122
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

When I install PowerShell 0.6.0 by using powershell-0.6.0-win81-x64.zip or PowerShell_0.6.0.0.msi, output of $PSVersionTable is not correct.

Expected behavior

PSEdition property should be Desktop, not Core.
CLRVersion property should not be empty.

Actual behavior

PS C:\Program Files\PowerShell\0.6.0.0> $PSVersionTable

Name                           Value
----                           -----
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
PSVersion                      5.1.10032.0
PSRemotingProtocolVersion      2.3
PSEdition                      Core
GitCommitId                    v0.6.0
CLRVersion
BuildVersion                   3.0.0.0

Activity

  1. vors commented on Jul 17, 2016

    @vors
    Collaborator

    In PSEdition Core is for CoreCLR, Desktop is for FullCLR, so there is no problems here.

  2. alexandair commented on Jul 17, 2016

    @alexandair
    ContributorAuthor

    Shouldn't CLRVersion property be populated?

  3. joeyaiello commented on Jul 20, 2016

    @joeyaiello
    Contributor

    Probably....

  4. modified the milestone: on Aug 4, 2016
  5. andyleejordan commented on Sep 19, 2016

    @andyleejordan
    Member

    This is purposefully not set because it is supposed to be [Environment]::Version, but that is not available in .NET Core (at least not in the current stable release; it is coming back per dotnet/corefx@fe5f4fb, which will be available in the next stable release). So while it is not available, it is set to null.

    Please note that the following will be confusing:

    ~/src/PowerShell |-/ [environment]::Version 
    
    Major  Minor  Build  Revision
    -----  -----  -----  --------
    4      0      30319  42000   

    This is due to Version being set in the environment extensions class for compatibility, and is not the actual CLR version.

    So $PSVersionTable is currently correct; but should be updated with the next release of .NET Core.

    Closing for now.

    /cc Dongbo Wang (@daxian-dbw)

  6. lzybkr commented on Sep 20, 2016

    @lzybkr
    Contributor

    If the api is coming back, this issue should be left open so we remember to fix the code.

    If the api never comes back, we should consider either removing the entry or fill it in explicitly. An empty value is useless.

  7. changed the title [-]incorrect $PSVersionTable output on Windows 10[/-] [+]$PSVersionTable.CLRVersion property should be populated in PowerShell Core[/+] on Oct 3, 2016
  8. added
    WG-Engine
    on Oct 3, 2016
  9. joeyaiello commented on Apr 12, 2017

    @joeyaiello
    Contributor

    Jason Shirk (@lzybkr) do you happen to know which API we depended upon here? I want to validate if it's coming back with 2.0

  10. lzybkr commented on Apr 12, 2017

    @lzybkr
    Contributor

    Looks like it's Environment.Version:

    s_psVersionTable["CLRVersion"] = Environment.Version;

  11. SteveL-MSFT commented on Apr 12, 2017

    @SteveL-MSFT
    Member

    Joey Aiello (@joeyaiello) Jason Shirk (@lzybkr) following Andy's link above to corefx, it appears Environment.Version is hardcoded to 4.0.30319.42000 for compat reasons. If the CLR version is useful (beyond this hardcoded string), it looks like we need to return the fileversion.

  12. 2 remaining items

  13. added
    Review - Committee
    on Apr 14, 2017
  14. joeyaiello commented on Apr 19, 2017

    @joeyaiello
    Contributor

    @PowerShell/powershell-committee discussed a bunch of options today:

    1. removing the property: given the type of $PSVersionTable, $PSVersionTable.CLRVersion will still just emit $null. A cursory search reveals a non-zero amount of instances of people using .Contains which would still break
    2. using the hardcoded value of [Environment]::Version
    3. using the .VersionInfo.FileVersion of coreclr.dll (4.6.somethingorother)

    Ultimately, the value is meaningless other than supporting back-compat. Given CoreCLR's decision to hardcode the string, we should talk to Immo Landwerth (@terrajobst) about .NET's thinking on this problem so that we don't do anything dumb.

  15. modified the milestones: , on May 23, 2017
  16. joeyaiello commented on May 23, 2017

    @joeyaiello
    Contributor

    Assigning to myself to ping Immo Landwerth (@terrajobst) about this.

  17. added
    Committee-Reviewed
    and removed
    Review - Committee
    on Jun 14, 2017
  18. SteveL-MSFT commented on Jun 14, 2017

    @SteveL-MSFT
    Member

    @PowerShell/powershell-committee discussed this with dotnet team and agree that we should not be exposing ClrVersion property as guidance from dotnet is that users should not be taking dependency on this value as it's not providing intended value

  19. changed the title [-]$PSVersionTable.CLRVersion property should be populated in PowerShell Core[/-] [+]$PSVersionTable.CLRVersion property should be removed in PowerShell Core[/+] on Jun 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Committee-ReviewedResolution-FixedWG-Engine

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions