Skip to content
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

Fix debugging script blocks that aren't in files #2064

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

andyleejordan
Copy link
Member

The code relied on running list 1 <MaxInt> but that wasn't being run in the debug context because we allow-list commands to prevent pollution of the history, and missed it. Like the prompt and interactive commands (which list could be but is not when we run it) we need to check for this exact list command and run it under the debugger.

Moreover, we also weren't locking the debugInfoHandle, nor were we correctly checking if scriptListingLines was empty (it was never null), and our shortcut to skip allocation was broken. Actually we can't skip allocation, but we can at least skip superfluous conversions.

Resolves PowerShell/vscode-powershell#3904.

The code relied on running `list 1 <MaxInt>` but that wasn't being run
in the debug context because we allow-list commands to prevent pollution
of the history, and missed it. Like the `prompt` and interactive
commands (which `list` could be but is not when we run it) we need to
check for this exact `list` command and run it under the debugger.

Moreover, we also weren't locking the `debugInfoHandle`, nor were we
correctly checking if `scriptListingLines` was empty (it was never
null), and our shortcut to skip allocation was broken. Actually we can't
skip allocation, but we can at least skip superfluous conversions.
@andyleejordan andyleejordan force-pushed the andyleejordan/fixScriptBlockDebugging branch from b126eda to a218596 Compare September 8, 2023 22:49
Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@andyleejordan andyleejordan added this pull request to the merge queue Sep 12, 2023
Merged via the queue into main with commit 0fcb641 Sep 12, 2023
13 checks passed
@andyleejordan andyleejordan deleted the andyleejordan/fixScriptBlockDebugging branch September 12, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Not in file Scriptblock debugging create empty temporary file
2 participants