PowerShell / PowerShell/vscode-powershell

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

Offen
#4,604 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Area-Debugging Issue-Bug
Vorherrschende Sprache
TypeScript
Sterne
1.9k
Forks
548
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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 the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.
Summary

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).

PowerShell Version
Name                           Value
----                           -----
PSVersion                      5.1.19041.2673
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.2673
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Visual Studio Code Version
1.78.2
b3e4e68a0bc097f0ae7907b217c1119af9e03435
x64
Extension Version
ms-vscode.powershell@2023.5.0
Steps to Reproduce

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).

Visuals

No response

Logs

[errors]

`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....`

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem protokollierten Stacktrace in Microsoft.PowerShell.EditorServices, insbesondere DebugAdapter.VariableDetails.SafeGetValue und GetChildren. Reproduziere den Fehler mit Get-CosmosDbDocument-Ergebnissen, die die aufgeführten Eigenschaften nicht enthalten und Nullwerte oder benutzerdefinierte Formatierung einschließen. Als abgeschlossen gilt die Aufgabe, wenn der Variableninspektor von VSCode das Objekt anzeigt, anstatt den gemeldeten internen Fehler zurückzugeben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
powershell, typescript, vscode
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.