PowerShell / PowerShell/vscode-powershell

Ability to quickly find runspaces that are awaiting for a debugger when attaching to a PowerShell Host Process

Open
#5,598 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Enhancement Needs: Triage
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
Summary

I'm working on a script that depends on the PODE module (a Web Server wrapped into a PowerShell module). The recommended approach to debugging it is to add Wait-PodeDebugger cmdlet in the code (wherever you need it to start waiting), trigger the respective code block and then attach to its process, find a runspace that's awaiting for the debugger using the below code and debug it:

Get-Runspace | Where-Object {$_.Debugger.InBreakpoint}

Unfortunately, the module produces a lot of runspaces and when you try to attach to the respective process with VSCode you see a list of ~20 runspaces with their respective RunspaceAvailability values (most of which are Busy) so picking the right one becomes a guesswork. Because of that I first need to attach to the process from a terminal, find the right runspace, detach the terminal and re-attach with VSCode:

Image

Is it possible to add the detail about whether the runspace is awaiting for the debugger to the label? That would greatly simplify the debugging workflow.

Thanks!

Proposed Design

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the VS Code attach-to-process flow with a PowerShell host containing multiple runspaces, then compare the runspace list with Get-Runspace | Where-Object {$_.Debugger.InBreakpoint}. Update the runspace label so it identifies entries awaiting the debugger, and verify that the attached process makes the correct runspace easy to select.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript, vscode
Domain
developer-experience, devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.