Add property and event for debug attach#25788
Add property and event for debug attach#25788SeeminglyScience merged 2 commits intoPowerShell:masterfrom
Conversation
kilasuit
left a comment
There was a problem hiding this comment.
Looks good & only minor thought, can you see benefit in also adding a OnDebugDetach event too?
I debated adding it internally and I couldn't think of a scenario where an end user would want to wait for a detach before continuing. But in saying that if there is something I haven't thought off I can definitely add it. |
|
Lets leave adding that as a future enhancement for now as it seems to be small enough a change that should be a good win for someone else coming to the repo looking to contribute. |
|
Thanks Jordan! Gonna add this to the Engine WG queue just to 👍 the public API and new engine event. |
|
/azp run PowerShell-Windows-Packaging-CI, PowerShell-CI-linux-packaging |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
|
The Engine WG was able to review this today & have signed off on adding this behaviour. We however would like additional code review to happen prior to merging. |
Adds the `IsRemoteDebuggerAttached` property to `Runspace` that indicates whether a debugger is attached to the Runspace through the `Debug-Runspace` cmdlet. Also adds a new engine event `PowerShell.OnDebugAttach` that is emitted when the debugger is attached.
5eb4ac5 to
3adbd64
Compare
|
/azp run PowerShell-Windows-Packaging-CI, PowerShell-CI-linux-packaging |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
src/Microsoft.PowerShell.Commands.Utility/commands/utility/DebugRunspaceCommand.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Patrick Meinecke <[email protected]>
|
/azp run PowerShell-CI-linux-packaging, PowerShell-Windows-Packaging-CI |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
|
📣 Hey @@jborean93, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
|
Thanks for the reviews! |
Adds the `IsRemoteDebuggerAttached` property to `Runspace` that indicates whether a debugger is attached to the Runspace through the `Debug-Runspace` cmdlet. Also adds a new engine event `PowerShell.OnDebugAttach` that is emitted when the debugger is attached.
PR Summary
Adds the
IsRemoteDebuggerAttachedproperty toRunspacethat indicates whether a debugger is attached to the Runspace through theDebug-Runspacecmdlet. Also adds a new engine eventPowerShell.OnDebugAttachthat is emitted when the debugger is attached.PR Context
Fixes: #21392
Also see PowerShell/PowerShellEditorServices#2250 which is the driver behind the new event. Unfortunately the only safe way to notify that code is safe to continue and a debugger is attached is through PowerShell. Sending our own event before calling
Debug-Runspacewon't work because the code could continue beforeDebug-Runspacehas set itself up. We cannot send an event after because the runspace will be busy runningDebug-Runspace.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header