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
I have searched all issues to ensure it has not already been requested.
Summary
I use VSCode for developing PowerShell modules. For debugging, I create a PowerShell configuration in the launch.json file with createTemporaryIntegratedConsole option enabled. This allows for a dedicated PowerShell session for debugging that is easy to restart.
In launch.json configuration, if the script option is not provided, the debugger still waits after the [TEMP] PowerShell Extension console opens: the debugger works in interactive mode, and if a command executed in the console hits a breakpoint, the debugger pauses. This mode allows you to efficiently debug a module, rather than having to update a temporary script.
If commands are entered in the script property in launch.json, for example to load the module and set the environment, the script is executed by PES and then the debugging session is stopped, although the temporary console remains open. This makes it impossible to debug in interactive mode. This requires not filling in the script property and manually entering the initialization commands each time the debugging session is (re)started, which is not practical for daily use when you frequently need to start from scratch.
Proposed Design
It would be useful if the debug session did not close until the temporary console is closed (since the primary purpose of running a script this way is to debug). While this cannot be enabled by default for reasons I do not know, an option to enforce this behavior would be welcome and very useful for developers.
For my part, I have implemented a workaround that meets this need, while waiting for an official solution, by modifying a line in the ConfigurationDoneHandler.cs file: jul-m@d864c89
The text was updated successfully, but these errors were encountered:
This used to be the behavior both here and for the "interactive mode" debug (not specifying a script), but it was changed several years ago. As of the last status @SeeminglyScience told me it should wait until #1853 gets merged but progress on that has stalled recently, perhaps I'll pick it up and find what further needs to be done there to get it over the finish line.
So I've been looking more into this and the tricky thing is that currently launch, attach, and "interactive mode" all follow very different initialization/run paths and so a setting to make this work has to permeate several services, especially if we make that a launch configuration setting and not a vscode setting (which is where I think it should be).
I might be able to put together something minimal until some of this stuff can be more unified e.g. #2191
Prerequisites
Summary
I use VSCode for developing PowerShell modules. For debugging, I create a PowerShell configuration in the
launch.json
file withcreateTemporaryIntegratedConsole
option enabled. This allows for a dedicated PowerShell session for debugging that is easy to restart.In
launch.json
configuration, if thescript
option is not provided, the debugger still waits after the[TEMP] PowerShell Extension
console opens: the debugger works in interactive mode, and if a command executed in the console hits a breakpoint, the debugger pauses. This mode allows you to efficiently debug a module, rather than having to update a temporary script.If commands are entered in the
script
property inlaunch.json
, for example to load the module and set the environment, the script is executed by PES and then the debugging session is stopped, although the temporary console remains open. This makes it impossible to debug in interactive mode. This requires not filling in thescript
property and manually entering the initialization commands each time the debugging session is (re)started, which is not practical for daily use when you frequently need to start from scratch.Proposed Design
It would be useful if the debug session did not close until the temporary console is closed (since the primary purpose of running a script this way is to debug). While this cannot be enabled by default for reasons I do not know, an option to enforce this behavior would be welcome and very useful for developers.
I haven't found a similar request here, but I did find one in the
vscode-powershell
repository: PowerShell/vscode-powershell#1168For my part, I have implemented a workaround that meets this need, while waiting for an official solution, by modifying a line in the
ConfigurationDoneHandler.cs
file: jul-m@d864c89The text was updated successfully, but these errors were encountered: