microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.05k stars 29.21k forks source link

Issue with the Variable inspector in VSCode's debug viewer for PowerShell #183159

Closed gitdram closed 1 year ago

gitdram commented 1 year ago

Type: Bug

There is an issue in the Variable inspector in VSCode's debug viewer for PowerShell. It appears that when an object has a custom format definition for displaying data, and if there is $null data for one of the object's default display properties, then the Variable inspector cannot display the data, but displays an error instead. This is evident with the CosmosDb module, when using the Get-CosmosDbDocument cmdlet. If the Cosmos query uses a custom SELECT statement and does not return the _rid, _self, _attachments, and the _etag properties in the results, then the Variable inspector displays an error (see attachment).

image

`Internal Error-System Management Automation Extended TypeSystemExceptionThe member "_rid" is not present at System Management Automation PSAliasProperty LookupMember(String nameHashSet 1 visitedAliasesPSMemberinfo& returned Member Boolean& hasCycle) at System Management Automation PSAliasProperty.LookupMember(String name) at System.Management Automation PSAliasProperty.get_Value()

] Internal Error at Microsoft PowerShell EditorServices Services DebugAdapter.VariableDetails SafeGetValue(PSPropertyInfo psProperty) at Microsoft PowerShell EditorServices Services DebugAdapter VariableDetails.<>c.b_14_2(PSPropertyinfo at System.Linq.Enumerable WhereSelectEnumerablelterator 2 MoveNext( p) 5] Internal Error - at System.Collections.Generic.List 1.InsertRange(int32 index, IEnumerable 1 collection) at Microsoft.PowerShell.EditorServicesServices.DebugAdapter.VariableDetails.GetChildren(Object obj, ILogger logger) at Microsoft PowerShell.EditorServices Services DebugAdapter.VariableDetails....`

VS Code version: Code 1.78.2 (b3e4e68a0bc097f0ae7907b217c1119af9e03435, 2023-05-10T14:39:26.248Z) OS version: Windows_NT x64 10.0.19045 Modes: Sandboxed: Yes

System Info |Item|Value| |---|---| |CPUs|Intel(R) Xeon(R) E-2276M CPU @ 2.80GHz (12 x 2808)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.71GB (16.75GB free)| |Process Argv|C:\\Users\\vclar4\\Documents\\GitHub\\DDI_testing --crash-reporter-id c6576e74-3e3d-4b5b-b8c2-8b086d72acf2| |Screen Reader|no| |VM|0%|
Extensions (17) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|3.0.2 vscode-azureautomation|azu|1.1.0 rest-client|hum|0.25.1 rainbow-csv|mec|3.7.0 vscode-azurefunctions|ms-|1.10.7 vscode-azureresourcegroups|ms-|0.7.5 vscode-docker|ms-|1.25.1 isort|ms-|2022.8.0 python|ms-|2023.8.0 jupyter|ms-|2023.4.1011241018 jupyter-keymap|ms-|1.1.0 vscode-jupyter-cell-tags|ms-|0.1.8 vscode-jupyter-slideshow|ms-|0.1.5 remote-wsl|ms-|0.78.7 azure-account|ms-|0.11.5 azurecli|ms-|0.5.0 powershell|ms-|2023.5.0
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593cf:30376535 pythonvs932:30410667 cppdebug:30492333 vsclangdf:30486550 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 282f8724:30602487 pyind779:30671433 f6dab269:30613381 pythonsymbol12:30671437 a9j8j154:30646983 showlangstatbar:30737416 vsctsb:30705553 pythonms35:30701012 pythonfmttext:30731395 pythoncmv:30739700 fixhidewlkth:30730051 hidesbindicator:30730055 pythongtdpathcf:30739705 ```
roblourens commented 1 year ago

Please file this on the C# debug extension, thanks

gitdram commented 1 year ago

I'm confused though. This is the PowerShell extension. Please clarify.

On Mon, May 22, 2023 at 3:06 PM Rob Lourens @.***> wrote:

Please file this on the C# debug extension, thanks

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode/issues/183159#issuecomment-1558091239, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7DC4U43TJN4S4I5BYMEEDXHPPPDANCNFSM6AAAAAAYK7L5SM . You are receiving this because you authored the thread.Message ID: @.***>

roblourens commented 1 year ago

Sorry, typo, I mean the powershell extension :)