You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a way to see if a remote debugger has attached #21392
Issue-Enhancementthe issue is more of a feature request than a bugWG-Enginecore PowerShell engine, interpreter, and runtimeWG-ReviewedA Working Group has reviewed this and made a recommendation
As a user who may want to attach to an otherwise unattended process to debug it, I want to be able to pause execution in said unattended process until I'm able to attach to it.
A common pattern in C# for this would be something like
while(!Debugger.IsAttached)Thread.Sleep(200);RestOfCodeHere();// breakpoint on this line
Currently in PowerShell there's no supported way to tell if a debugger is attached to the current runspace. A minimal way to enable this scenario would be a property on Runspace:
public partial abstract class Runspace
{
+ public bool IsRemoteDebuggerAttached { get; }
}
This would allow the user to write the code
while (-not$Host.Runspace.IsRemoteDebuggerAttached) { Start-Sleep-Milliseconds 200 }
Invoke-RestOfCodeHere# breakpoint on this line, or just make it `Wait-Debugger`
If there is sufficient demand for it, a command or method to wait for attach can also be considered, but to start off the proposal I'd recommend this as an MVP.
One question that I would suggest be answered in the WG decision is: "What should a remote runspace do for this parameter? Throw? Or always return false?"
Reacted by Michael Klement, Ryan Yates, luma-sb and Martin Hinshelwood nkdAgility.com
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.
Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.
I've found a need for this for attaching to a pwsh instance in PSES. I've opened #25788 which adds the property specified here but also write a new event which is easy for people to wait on.
Issue-Enhancementthe issue is more of a feature request than a bugWG-Enginecore PowerShell engine, interpreter, and runtimeWG-ReviewedA Working Group has reviewed this and made a recommendation
Activity
SeeminglyScience commentedon Apr 1, 2024
The Engine WG discussed this and agree
microsoft-github-policy-service commentedon Sep 29, 2024
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.
Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.
jborean93 commentedon Jul 29, 2025
I've found a need for this for attaching to a pwsh instance in PSES. I've opened #25788 which adds the property specified here but also write a new event which is easy for people to wait on.
microsoft-github-policy-service commentedon Oct 7, 2025
📣 Hey @Patrick Meinecke (@SeeminglyScience), how did we do? We would love to hear your feedback with the link below! 🗣️
🔗 https://aka.ms/PSRepoFeedback