PowerShell / PowerShell/PowerShell
Debugging: `Set-PSBreakpoint -Command` is triggered for each invocation of a `ForEach-Object` script block inside a targeted function
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C#
- Sterne
- 55.5k
- Forks
- 8.5k
- Ø Merge
- 1 T. 2 Std.
- Gemergte PRs (30 T.)
- 88
Beschreibung
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Run the following:
function foo {
1..3 | ForEach-Object { '#' + $i }
}
$bp = Set-PSBreakpoint -Command foo
foo
$bp | Remove-PSBreakpoint
-
The debugger is entered and execution stops before the first statement of the
foofunction. -
Submit
oto step out of the function.
Expected behavior
The debugger should step out of the function.
Actual behavior
Instead of exiting the function, execution breaks at the start of the ForEach-Object script block, preceded by message Hit Command breakpoint on 'foo', as if the function had been invoked again.
Error details
No response
Environment data
PowerShell 7.5.0-preview.3
Visuals
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die Reproduktionsschritte mit Set-PSBreakpoint, ForEach-Object und dem Step-out-Befehl des Debuggers auszuführen. Da das Issue keine Quelldatei, keinen Test und keinen Einstiegspunkt nennt, ermittle die Implementierung von Befehls-Breakpoints und Step-out anhand des Verhaltens des Debuggers. Als erledigt gilt die Aufgabe, wenn das Step-out aus foo keinen Breakpoint innerhalb seines ForEach-Object-Skriptblocks mehr auslöst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- powershell
- Bereich
- cli, devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100