question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Debug Pester Tests

See original GitHub issue

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® Core™ 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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
SydneyhSmithcommented, Mar 2, 2021

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 https://github.com/PowerShell/PowerShellEditorServices/issues/1295

0reactions
msftbot[bot]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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code: Pester tests not showing in test explorer
I have the latest Powershell Extension installed (v2022.8.5). It looks like test discovering does not work, but I can run/debug single describe ...
Read more >
Output - Pester
Pester uses customizable console output to show tests results, errors and summary. ... This level behaves like Detailed, but also enables debug-messages.
Read more >
Debugging PowerShell Modules with Pester Unit Tests in ...
If you are the author of a PowerShell module, you can use the built-in debugging tools in Microsoft Visual Studio Code to debug...
Read more >
Debugging Test Scripts - Micro Focus
To start debugging, open the test script or the keyword-driven test script in the editor and click Run > Debug in the Silk...
Read more >
Debugging PowerShell script in Visual Studio Code – Part 1
First look at the PowerShell Debugger in Visual Studio Code ... where the scriptblock tests for a certain condition, and if met, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found