Powershell: Installing VS 15.6 breaks Powershell JSON handling

Created on 8 Mar 2018  ·  3Comments  ·  Source: PowerShell/PowerShell

Visual Studio 15.6 which was recently released (https://blogs.msdn.microsoft.com/visualstudio/2018/03/06/visual-studio-2017-version-15-6-visual-studio-for-mac-version-7-4-released) breaks / Powershell JSON handling

Issue 1:

Steps to reproduce

"[{x:'b'},{x:'a'}]" | ConvertFrom-Json | ConvertTo-Json

Expected behavior

before VS 15.6 used to return

[
  {
      "x":  "b"
  },
  {
      "x":  "a"
  }
]

Actual behavior

With VS 15.6 installed returns

{
    "value":  [
                  {
                      "x":  "b"
                  },
                  {
                      "x":  "a"
                  }
              ],
    "Count":  2
}

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.16299.248
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.248
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue 2:

Steps to reproduce

"[{x:'b'},{x:'a'}]" | ConvertFrom-Json | Sort-Object -Property x

Expected behavior

before VS 15.6 used to return

x
-
a
b

Actual behavior

With VS 15.6 installed returns

x
-
b
a

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.16299.248
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.248
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Issue-Question OS-Windows Resolution-Answered Resolution-External

All 3 comments

I have a VM with VS 15.5.6 installed and can say there is no difference between my dev laptop that has VS 15.6.1
What you describe as expected is what I get in PowerShell 6 (both machines), and what you describe as actual, I get on Windows PowerShell 5.1 on both machines. Note that this repo is only for issues of PowerShell 6.

To add to @bergmeister's comment: The issue you describe was fixed in _Core_ a while back (but still exists in _Windows PowerShell_ v5.1): #3153

As stated in the bug template:

For Windows PowerShell 5.1 issues, suggestions, or feature requests please use the following link instead:

Was this page helpful?
0 / 5 - 0 ratings