-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add property and event for debug attach #25788
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
Conversation
kilasuit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Jordan! Just two minor suggestions. Feel free to ping me on discord when resolved and I'll merge after tests finish
src/Microsoft.PowerShell.Commands.Utility/commands/utility/DebugRunspaceCommand.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Patrick Meinecke <SeeminglyScience@users.noreply.github.com>
SeeminglyScience
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
/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