SetValue for nested field throws "Unable to cast object"
还没有人认领这个 Issue。
评估
调研方向
先从 src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs 第 390 行附近开始,然后在调试时使用嵌套的 PSCustomObject 重现报告的步骤。更改 NestedField 时跟踪 SetValue 路径,并验证更新完成时不会出现 VariableDetails 到 VariableContainerDetails 的类型转换错误。
由索引模型根据 Issue 内容生成。
描述
Prerequisites
- I have written a descriptive issue title.
- I have searched all open and closed issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with PowerShell Editor Services itself and does not reproduce in a standalone PowerShell instance, and is not an issue with my editor.
- I have verified that I am using the latest version of PowerShell Editor Services.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
Setting nested field value throws
Unable to cast object of type 'Microsoft.PowerShell.EditorServices.Services.DebugAdapter.VariableDetails' to type 'Microsoft.PowerShell.EditorServices.Services.DebugAdapter.VariableContainerDetails'.
The code below should be causing the problem.
PowerShell Version
Name Value
---- -----
PSVersion 7.4.3
PSEdition Core
GitCommitId 7.4.3
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Editor Version
Visual Studio Code
Version: 1.91.1 (user setup)
Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729
Date: 2024-07-09T22:06:49.809Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.19045
PowerShell Editor Services Version
Major Minor Build Revision
----- ----- ----- --------
3 20 1 0
Steps to Reproduce
$val = [PSCustomObject]@{
NestedField = "Test"
}
Write-Host $val
while ($true) {
Write-Host $val
}
- Put breakpoint on line 4 (
Write-Host $val) - Start debugging
- Open "Local" scope in Variables tab
- Find $val and change NestedField value
Visuals
No response
Logs
No response
- 主要语言
- C#
- 星标
- 780
- 派生
- 267
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PowerShell/PowerShellEditorServices 的其他 Issue
-
Issue-Enhancement Needs: Triage
难度 3/5 1-2 天 新手友好度 35/100
-
[Bug] None of the string overloads of `EditorExtensionServiceProvider.GetService()` work on .NET.可能重新可做 @andyleejordan 于 143 天前认领,目前没有进行中的 PR。 未关闭
PowerShell/PowerShellEditorServices#2331 · 1 个 reaction · 已指派 2 人 ·
-
Area-Language Server Issue-Enhancement
难度 4/5 3-5 天 新手友好度 48/100
PowerShell/PowerShellEditorServices#2315 · 1 条评论 ·
-
Improve Constrained Runspace Debug Experience可能已有人在做 @JustinGrote 于 166 天前认领。 未关闭Area-Debugging Issue-Enhancement
PowerShell/PowerShellEditorServices#2294 · 1 个 reaction · 已指派 2 人 ·
-
Issue-Bug Needs: Triage
难度 4/5 3-5 天 新手友好度 48/100
PowerShell/PowerShellEditorServices#2293 · 1 条评论 ·
查看 PowerShell/PowerShellEditorServices 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
vikramlearning/blazorbootstrap#1388 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
GamaEdtech/gamatrain-back#977 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
valkey-io/valkey-glide#7745 ·
维护者通常 1 天内回复
-
area-templates triage:bot-seen triage:needs-human
难度 2/5 1-3 小时 新手友好度 75/100
microsoft/aspire#22356 · 1 条评论 ·
维护者通常 1 天内回复
-
Needs-Triage
难度 2/5 1-3 小时 新手友好度 84/100
PowerShell/PowerShell#28432 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复