Skip to content

Not in file Scriptblock debugging create empty temporary file #3904

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

Closed
5 of 6 tasks
ili101 opened this issue Apr 2, 2022 · 8 comments · Fixed by PowerShell/PowerShellEditorServices#2064
Closed
5 of 6 tasks
Assignees
Labels

Comments

@ili101
Copy link

ili101 commented Apr 2, 2022

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

On stable a temporary file is created with the content of the scriptblock and debugged normally.
On preview temporary empty file is created.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.2.2
PSEdition                      Core
GitCommitId                    7.2.2
OS                             Microsoft Windows 10.0.22000
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

1.66.0
e18005f0f1b33c29e81d732535d8c0e47cafb0b5
x64

Extension Version

Steps to Reproduce

$X = {
    Set-PSBreakpoint -Variable Foo
    $Foo = 0
    1
    2
    3
}.ToString()

. ([Scriptblock]::Create($X))

Visuals

image

Logs

No response

@ili101 ili101 added the Issue-Bug A bug to squash. label Apr 2, 2022
@ghost ghost added the Needs: Triage Maintainer attention needed! label Apr 2, 2022
@SeeminglyScience
Copy link
Collaborator

I noticed this as well while working on something attach to process related. Glad to know it's not something I just broke :)

Lookin' into it, thanks @ili101!

@SydneyhSmith SydneyhSmith added Area-Debugging and removed Needs: Triage Maintainer attention needed! labels Apr 5, 2022
@SydneyhSmith SydneyhSmith moved this to Todo in Sea Biscuit Apr 5, 2022
@SydneyhSmith SydneyhSmith added this to the Consider-vNext milestone Apr 5, 2022
@andyleejordan andyleejordan moved this from Todo to Wishlist in Sea Biscuit Apr 13, 2022
@andyleejordan
Copy link
Member

Has this continued to repro?

@ili101
Copy link
Author

ili101 commented Apr 22, 2022

Yes still broken in preview

@SeeminglyScience
Copy link
Collaborator

SeeminglyScience commented Apr 23, 2022

Yep it's on my list but I haven't actually done anything to fix it yet.

I was initially thinking it wouldn't be a blocker but this might make debugging pester tests in particular a huge PITA. Assuming Pester still creates anonymous scriptblocks for mocks anyway

@SydneyhSmith SydneyhSmith moved this from Todo to P1 - Todo in American Pharoah May 3, 2022
@SydneyhSmith SydneyhSmith moved this from P1 - Todo to P0 - Todo in American Pharoah May 3, 2022
@andyleejordan
Copy link
Member

From Patrick: The remote file manager is for some reason not populating the file in this scenario, but is creating it.

@andyleejordan andyleejordan self-assigned this Aug 3, 2022
@andyleejordan
Copy link
Member

Easy way to repro: type "Wait-Debugger" in console.

@SydneyhSmith SydneyhSmith removed this from the Consider-vNext milestone Aug 9, 2022
@andyleejordan andyleejordan moved this from Wishlist to Punted in Sea Biscuit Oct 12, 2022
@SydneyhSmith SydneyhSmith moved this to Todo in Flying Fox Mar 28, 2023
@andyleejordan
Copy link
Member

Ok I have a partial answer. Debugging this, in the DebugService we have this bit of code that should be getting the lines of the script...and it's not:

                    PSCommand psCommand = new PSCommand().AddScript($"list 1 {int.MaxValue}");

                    IReadOnlyList<PSObject> scriptListingLines =
                        await _executionService.ExecutePSCommandAsync<PSObject>(
                            psCommand, CancellationToken.None).ConfigureAwait(false);

Hence why that temporary file is empty. scriptListingLines is quite empty!

@andyleejordan
Copy link
Member

Sorry this took so long @ili101 but it will be fixed in the next pre-release!

@github-project-automation github-project-automation bot moved this from Punted to Done in Sea Biscuit Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants