PowerShell / PowerShell/vscode-powershell

PowerShell attach removes existing breakpoints in attached session

Offen
#4,489 21 Kommentare 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

I use VSCode PowerShell debugger by attaching to a process hosting PowerShell.
Attaching removes breakpoints that I have already set in my session.

PowerShell Version
Name                           Value
----                           -----
PSVersion                      7.3.3
PSEdition                      Core
GitCommitId                    7.3.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
Visual Studio Code Version
1.73.1
6261075646f055b99068d3688932416f2346dd3b
x64
Extension Version
ms-vscode.powershell@2023.3.3
Steps to Reproduce

(1) Invoke the below script test1.ps1 in some PowerShell session. E.g. I used and saw the problem in powershell and pwsh consoles and in my application hosting PowerShell as well.

function global:test1 {
	'hi'
}
Set-PSBreakpoint -Command test1
Set-PSBreakpoint -Script $PSScriptRoot\test1.ps1 -Line 2

(2) Run Get-PSBreakpoint -- see 2 breakpoints

(3) In VSCode, launch/attach PowerShell debugger configured as below.
Select the target process where we have set 2 breakpoints.

      {
        "type": "PowerShell",
        "request": "attach",
        "name": "PowerShell attach",
        "processId": "${command:PickPSHostProcess}",
        "runspaceId": 1
      },

(4) With the debugger attached, run Get-PSBreakpoint again -- see that breakpoints are gone.

Visuals

No response

Logs

No response

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 dem bereitgestellten Skript test1.ps1, zwei Set-PSBreakpoint-Aufrufen und der PowerShell-Attach-Konfiguration mit PickPSHostProcess. Beginne damit, den Debugger-Attach-Ablauf nachzuverfolgen und Get-PSBreakpoint vor und nach dem Attach zu vergleichen. Als erledigt gilt die Aufgabe, wenn das Attach beide vorhandenen Breakpoints erhält; im Issue wird keine Testdatei oder kein Source-Einstiegspunkt genannt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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