Title: Add a way to see if a remote debugger has attached · Issue #21392 · PowerShell/PowerShell · GitHub
Open Graph Title: Add a way to see if a remote debugger has attached · Issue #21392 · PowerShell/PowerShell
X Title: Add a way to see if a remote debugger has attached · Issue #21392 · PowerShell/PowerShell
Description: Summary of the new feature / enhancement 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. Proposed technical ...
Open Graph Description: Summary of the new feature / enhancement 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 a...
X Description: Summary of the new feature / enhancement 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'...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/21392
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add a way to see if a remote debugger has attached","articleBody":"### Summary of the new feature / enhancement\r\n\r\nAs 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.\r\n\r\n### Proposed technical implementation details (optional)\r\n\r\nA common pattern in C# for this would be something like\r\n\r\n```cs\r\nwhile (!Debugger.IsAttached) Thread.Sleep(200);\r\nRestOfCodeHere(); // breakpoint on this line\r\n```\r\n\r\nCurrently 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`:\r\n\r\n```diff\r\npublic partial abstract class Runspace\r\n{\r\n+ public bool IsRemoteDebuggerAttached { get; }\r\n}\r\n```\r\n\r\nThis would allow the user to write the code\r\n\r\n```powershell\r\nwhile (-not $Host.Runspace.IsRemoteDebuggerAttached) { Start-Sleep -Milliseconds 200 }\r\nInvoke-RestOfCodeHere # breakpoint on this line, or just make it `Wait-Debugger`\r\n```\r\n\r\nIf 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.\r\n\r\nOne 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?\"\r\n","author":{"url":"https://github.com/SeeminglyScience","@type":"Person","name":"SeeminglyScience"},"datePublished":"2024-03-29T15:55:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/21392/PowerShell/issues/21392"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:06e934fb-15a7-86ee-ff55-3b80a0598942 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CF9A:1EB0:9026D7:D1E79F:6A578A3B |
| html-safe-nonce | 8d5de6c7589af23d32dc605fd5c30e0bc50e7f4afee23197c5a603c410473ecf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRjlBOjFFQjA6OTAyNkQ3OkQxRTc5Rjo2QTU3OEEzQiIsInZpc2l0b3JfaWQiOiI3NzAxNzk1OTU0NjY0OTAxMTc5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f7c961d4328a6846a08ad9132b149c8e1748790d6c3201738abfe901529eaab3 |
| hovercard-subject-tag | issue:2215612521 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/21392/issue_layout |
| twitter:image | https://opengraph.githubassets.com/950c30b05b8ab22c2437bd1e9794371de959c4205fd1a58c949c18d2f2689d4a/PowerShell/PowerShell/issues/21392 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/950c30b05b8ab22c2437bd1e9794371de959c4205fd1a58c949c18d2f2689d4a/PowerShell/PowerShell/issues/21392 |
| og:image:alt | Summary of the new feature / enhancement 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 a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SeeminglyScience |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6353e56e94423c9cd5abde7708a859afa36a0c1203c73749055bf6ee6704cd0 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f59ab1c46b638204e2aea09126d089be5dc773b7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width