Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Debug Pester Tests #3199

Closed
GityupSS opened this issue Feb 23, 2021 · 8 comments
Closed

Cannot Debug Pester Tests #3199

GityupSS opened this issue Feb 23, 2021 · 8 comments
Labels
Area-Debugging Issue-Bug A bug to squash. Needs: Author Feedback Please give us the requested feedback!

Comments

@GityupSS
Copy link

GityupSS commented Feb 23, 2021

Issue Type: Bug

problem started after January 2021 update
currently using powershell 7.1.2 and pester 4.10.1.
Used to work with Powershell 2020.6.0 extension... I even tried with Powershell 2020.9.0 preview, with the same result.

When using "run tests", works OK.
When using "Debug tests" without BreakPoints, work like "run tests"
When using "Debug tests" with BreakPoints, Debug side window opens,

Then either nothing happens (last time I let it run for 20 minutes) Shift-F5 to Stop
Either tests runs without stopping on breakpoints and stalls after this output in terminal:
################################
WARNING: Breakpoint Command breakpoint on '' will not be hit

Hit Command breakpoint on ''

[DBG]: PS C:\WorkSpace\Scripts>

Hit Command breakpoint on ''
################################
As well as, ps1 file open
C:\Users\ username\AppData\Local\Temp\PSES-18484\ [HOSTNAME] Script Listing.ps1
with only "0" in its content.

Extension version: 2020.6.0
VS Code version: Code 1.53.2 (622cb03f7e070a9670c94bae1a45d78d7181fbd4, 2021-02-11T11:48:04.245Z)
OS version: Windows_NT x64 10.0.18363

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz (8 x 2112)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: enabled
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.34GB (7.61GB free)
Process Argv --crash-reporter-id 4eac389b-80c0-4b6e-a084-accb1ae224fc
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstry914:30256638
pythonvsdeb440:30248342
pythonvsded773:30248341
pythonvspyt875:30259475

@ghost ghost added the Needs: Triage Maintainer attention needed! label Feb 23, 2021
@GityupSS
Copy link
Author

I Also get this error when I Stop the debugger in a stalled state
2021-02-23 09_19_08-Window

@GityupSS
Copy link
Author

GityupSS commented Feb 23, 2021

I've installed VSCODE 1.52.1 and it seems a little better.
it does the same thing: tests the code with pester, then halts, but when I SHIFT-F5 to stop, another Hit Command breakpoint on '' shows up. I need to click Stop for every breakpoint and then debugger stops correctly.

Also, at the very end, [HOSTNAME] script Listing.ps1 file is populated with :

$global:__psEditorServices_CallStack = Get-PSCallStack; $global:__psEditorServices_CallStack

instead of 0.

@SydneyhSmith
Copy link
Collaborator

Thanks @GityupSS it would be really helpful if you could also attach the logs--instructions for how to do that are here

@SydneyhSmith SydneyhSmith added Needs-Repro-Info and removed Needs: Triage Maintainer attention needed! labels Feb 23, 2021
@GityupSS
Copy link
Author

Enabling diagnostics makes VSCODE crash! This is getting weirder!!!
2021-02-24 08_57_46-Window

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Feb 24, 2021
@GityupSS
Copy link
Author

here are the logs
logs-posh-vscode.zip

@SydneyhSmith
Copy link
Collaborator

Thanks for providing the logs they are helpful, it looks like this is causing the issue:

2021-02-24 09:33:10.920 -05:00 [WRN] Runtime exception occurred while executing command:

System.Management.Automation.RuntimeException: An error occurred while creating the pipeline.
 ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at System.Management.Automation.Runspaces.LocalPipeline.CreatePipelineProcessor()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke[T](IEnumerable input, PSInvocationSettings settings)
   at Microsoft.PowerShell.EditorServices.Services.PowerShellContextService.ExecuteCommandAsync[TResult](PSCommand psCommand, StringBuilder errorMessages, ExecutionOptions executionOptions) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShellContext\PowerShellContextService.cs:line 927
   at Microsoft.PowerShell.EditorServices.Services.PowerShellContextService.ExecuteCommandAsync[TResult](PSCommand psCommand, StringBuilder errorMessages, ExecutionOptions executionOptions) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShellContext\PowerShellContextService.cs:line 927
2021-02-24 09:33:10.920 -05:00 [ERR] ReleaseRunspaceHandle was called when the main thread was not busy.

In other words, it looks like the runspace is getting into a bad state, this will hopefully be resolved by the PowerShell/PowerShellEditorServices#1295

@SydneyhSmith SydneyhSmith added Area-Debugging Issue-Bug A bug to squash. and removed Needs-Repro-Info Needs: Maintainer Attention Maintainer attention needed! labels Mar 2, 2021
@andyleejordan
Copy link
Member

Hello, and thank you for your patience! The latest PowerShell Preview for VS Code is now out, and includes the reworking of our pipeline and threading architecture in PowerShell/PowerShellEditorServices#1295. Could you verify if this issue still reproduces using v2021.10.3-preview? Please note that this preview is likely to include other bugs, and you should feel free to file new issues for those so we can work through them. Thanks again!

@andyleejordan andyleejordan added the Needs: Author Feedback Please give us the requested feedback! label Oct 29, 2021
@ghost ghost closed this as completed Nov 6, 2021
@ghost
Copy link

ghost commented Nov 6, 2021

This issue was closed automatically as author feedback was indicated as needed, but there has been no activity in over a week. Please feel free to reopen with any available information!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Debugging Issue-Bug A bug to squash. Needs: Author Feedback Please give us the requested feedback!
Projects
None yet
Development

No branches or pull requests

3 participants