PowerShell / PowerShell/PowerShell
$PSVersionTable does not correctly implement ToString, causing issues with Set-Clipboard
未关闭
还没有人认领这个 Issue。
Needs-Triage
- 主要语言
- C#
- 星标
- 55.5k
- 派生
- 8.5k
- 平均合并
- 1 天 2 小时
- 30 天内合并 PR
- 88
描述
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Since #18116 has been implemented, I have tried to use it when filling out issues on my remote setup, but I need to pipe it via Out-String for it to work properly. This seems to be caused by it not implementing ToString() correctly, instead relying on formatters to display its information.
Expected behavior
> $PSVersionTable | Set-Clipboard
> Get-Clipboard # Ctrl+Shift+V
Name Value
---- -----
PSVersion 7.4.0-preview.4
PSEdition Core
GitCommitId 7.4.0-preview.4
OS Ubuntu 22.04.2 LTS
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Actual behavior
> $PSVersionTable | Set-Clipboard
> Get-Clipboard
System.Management.Automation.PSVersionHashTable
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.4.0-preview.4
PSEdition Core
GitCommitId 7.4.0-preview.4
OS Ubuntu 22.04.2 LTS
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 $PSVersionTable、Set-Clipboard 和 Get-Clipboard 重现报告中的管道,然后跟踪 PSVersionHashTable 类型及其字符串转换行为。当直接将 $PSVersionTable 通过管道传递给 Set-Clipboard 时,无需 Out-String 即可生成 Expected behavior 下所示的格式化名称和值输出,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, powershell
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100