PowerShell / PowerShell/PowerShellEditorServices

Don't stop debugging after script execution in TemporaryIntegratedConsole

Ouverte
#2,180 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Area-Debugging Issue-Enhancement
Langage dominant
C#
Étoiles
767
Forks
266
Merge moyen
3 j 16 h
PR mergées (30 j)
1

Description

Prerequisites
  • I have written a descriptive issue title.
  • 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.

I haven't found a similar request here, but I did find one in the vscode-powershell repository: https://github.com/PowerShell/vscode-powershell/issues/1168

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: https://github.com/jul-m/PowerShellEditorServices/commit/d864c898600b82dd9b33f5abf7d7327c8af7224b

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par ConfigurationDoneHandler.cs et examinez le commit de workaround référencé, puis comparez l’issue vscode-powershell associée. Vérifiez comment un script configuré met fin à la session de débogage tout en laissant la console temporaire ouverte. Le travail est considéré comme terminé lorsque la session peut rester active pour le débogage interactif avec des points d’arrêt après l’exécution du script et se termine à la fermeture de la console temporaire, de préférence derrière une option.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp, powershell
Domaine
devtools
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.