最近发布的 Visual Studio 15.6 (https://blogs.msdn.microsoft.com/visualstudio/2018/03/06/visual-studio-2017-version-15-6-visual-studio-for-mac-version- 7-4-released) 中断/Powershell JSON 处理
问题 1:
"[{x:'b'},{x:'a'}]" | ConvertFrom-Json | ConvertTo-Json
VS 15.6 之前用于返回
[
{
"x": "b"
},
{
"x": "a"
}
]
安装 VS 15.6 后返回
{
"value": [
{
"x": "b"
},
{
"x": "a"
}
],
"Count": 2
}
> $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
问题 2:
"[{x:'b'},{x:'a'}]" | ConvertFrom-Json | Sort-Object -Property x
VS 15.6 之前用于返回
x
-
a
b
安装 VS 15.6 后返回
x
-
b
a
> $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
我有一个安装了 VS 15.5.6 的虚拟机,可以说我的开发笔记本电脑与 VS 15.6.1 没有区别
您所描述的预期内容是我在 PowerShell 6(两台机器)中获得的内容,而您所描述的实际内容是我在两台计算机上的 Windows PowerShell 5.1 中获得的内容。 请注意,此 repo 仅适用于 PowerShell 6 的问题。
添加到@bergmeister的评论:您描述的问题已在 _Core_ 中修复一段时间(但在 _Windows PowerShell_ v5.1 中仍然存在):#3153
如错误模板中所述:
对于 Windows PowerShell 5.1 问题、建议或功能请求,请改用以下链接:
- Windows PowerShell 用户语音