PowerShell / PowerShell/vscode-powershell

Cannot Set Breakpoints When Remote Debugging PowerShell

Offen
#4,531 7 Kommentare 1 Reaktion 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

I am attempting to use VSCode for remote editing and debugging PowerShell files following this guide. I am able to run and attempt to debug my remote file after opening with psedit <filename>, but it appears breakpoints do not work as expected. It appears VSCode opens a file on my host machine with the path of the remote file (which does not exist on the host) and tries to attach the debugger to that. It will respect the original breakpoint set before it ran initially and I can even see variables on the left side, but I do not have the ability to alter breakpoints on the file or inspect variable values by hovering over them.

PowerShell Version
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      22621  963
Visual Studio Code Version
1.77.3
704ed70d4fd1c6bd6342c436f1ede30d1cff4710
x64
Extension Version
ms-vscode.powershell@2023.4.0
Steps to Reproduce
  • Open VSCode, create a new file, set file type to PowerShell
  • Wait for integrated console to come up, type in the following:
Enter-PSSession -ComputerName <IPAdress> -Credential $credObject
New-Item test.ps1
psedit test.ps1
  • Paste or write whatever code you want to execute and then CTRL + S
  • Set a breakpoint after our variable assignment and hit F5 to debug. This will attempt to open a file on the host with the path of the remote file. This file does not exist. It will also remove the breakpoint from the original remote file and put it on this file.
  • We can now no longer create new breakpoints or hover over values.
Visuals

image

Logs

Logs.zip

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

Reproduziere das Problem mit Enter-PSSession, psedit, einem Breakpoint und F5 und untersuche anschließend anhand der angehängten Logs.zip das Remote-Debugging und die Breakpoint-Verarbeitung der Erweiterung. Abgeschlossen ist die Aufgabe, wenn Remote-Dateien nicht als ungültige Hostpfade geöffnet werden und Breakpoints sowie die Variablen-Hover-Inspektion nach dem Start des Debuggings weiterhin nutzbar sind.

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
42/100

Neue Issues direkt in Ihr Postfach

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