PowerShell / PowerShell/vscode-powershell

Debug PSTask PSInvalidOperationException

Aperta
#3,363 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area-Debugging Issue-Bug
Lingua principale
TypeScript
Stelle
1.9k
Fork
548
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Issue Type: Bug

When debugging a PSTaskJob (Runspace) a get the following exception:
.PSInvalidOperationException: The pipeline was not run because a pipeline is already running. Pipelines cannot be run concurrently.

TestScript.ps1

$files = @("file1.txt","file2.txt","file3.txt");

$files | ForEach-Object -AsJob -Parallel {

    Wait-Debugger
    Write-Output "Scanning $($_)";
}

=====================================
Command to reproduce in Powershell Integrated Terminal:

PS> .\TestScript.ps1
PS> Get-Runspace
 Id Name            ComputerName    Type          State         Availability
 -- ----            ------------    ----          -----         ------------
  1 Runspace1       localhost       Local         Opened        Available   
  4 Runspace4       localhost       Local         Opened        Busy        
  6 PSTask:1        localhost       Local         Opened        InBreakpoint
  7 PSTask:2        localhost       Local         Opened        InBreakpoint
  8 PSTask:3        localhost       Local         Opened        InBreakpoint
PS> Get-Runspace -Id 6 | Debug-Runspace

Debugging Runspace: PSTask:1
To end the debugging session type the 'Detach' command at the debugger prompt, or type 'Ctrl+C' otherwise.


Entering debugged runspace on local machine NB0001
[DBG]: [Process:17600]: [PSTask:1]: PS C:\Users\Albert\Source\Repos\Test>> l


    1:
    2:
    3:*     Wait-Debugger
    4:      Write-Output "Scanning $($_)";
    5:


[DBG]: [Process:17600]: [PSTask:1]: PS C:\Users\Albert\Source\Repos\Test>> v

PSInvalidOperationException: The pipeline was not run because a pipeline is already running. Pipelines cannot be run concurrently.

The Debugger crashes and returns the same exception in a loop

Extension version: 2021.2.2
VS Code version: Code 1.56.2 (054a9295330880ed74ceaedda236253b4f39a335, 2021-05-12T17:13:13.157Z)
OS version: Windows_NT x64 10.0.19041

System Info
Item Value
CPUs Intel(R) Core(TM) i7-3840QM CPU @ 2.80GHz (8 x 2794)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.91GB (5.58GB free)
Process Argv --crash-reporter-id e3696b06-ea94-400b-b7e5-70c7ac80803d
Screen Reader no
VM 0%

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con la riproduzione fornita in TestScript.ps1, quindi esegui Get-Runspace e Debug-Runspace sui runspace di PSTask. Traccia il comportamento del debugger quando un runspace è in InBreakpoint e la pipeline è già in esecuzione. Il lavoro è completato quando il debug non va più in crash e non ripete più il ciclo PSInvalidOperationException.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell, typescript, vscode
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.