Skip to content

Script fails to run on second run #2319

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
DarkLite1 opened this issue Nov 20, 2019 · 11 comments · Fixed by PowerShell/PowerShellEditorServices#1117
Closed

Script fails to run on second run #2319

DarkLite1 opened this issue Nov 20, 2019 · 11 comments · Fixed by PowerShell/PowerShellEditorServices#1117
Assignees
Labels
Area-Debugging Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.

Comments

@DarkLite1
Copy link

DarkLite1 commented Nov 20, 2019

On request of @TylerLeonhardt in #2175 I am creating this as a separate issue.

Description

When breakpoints are set in at least two other open files, the current open file (which does not contain a breakpoint) can only be executed once. Upon a second execution vscode-insders freezes.

Steps to reproduce the issue:

  1. Create 3 files:
    File1.ps1 contains code with no breakpoint (Ex. Get-Process)
    File2.ps1 contains code with a breakpoint (Ex. Start-Sleep -Seconds 1, breakpoint line 1)
    File3.ps1 contains code with a breakpoint (Ex. Start-Sleep -Seconds 1, breakpoint line 1)
  2. When all 3 files are open in the editor pane and File1.ps1 is focused press F5
    Notice that Get-Process is executed correctly and all processes are retrieved
  3. Press F5 again and notice that Get-Process is not executed, an orange bar is displayed at the bottom and the debug panel to stop debugging is floating at the top but doesn't respond to any clicks and stays there.
    image

Workarounds:

  • Close and reopen vscode-insiders to have one other successful run
  • Remove all breakpoints in all other files

System details

@rjmholt I hope you can simulate this properly now. I'm currently using PowerShell Preview 2019.11.0 and vscode-insiders:

Version: 1.41.0-insider (user setup)
Commit: 4934a6f487b9ed6b99b900ae0710c7b452792e20
Date: 2019-11-20T05:25:39.619Z
Electron: 6.1.4
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 6.2.9200
@ghost ghost added the Needs: Triage Maintainer attention needed! label Nov 20, 2019
@JamesLear92
Copy link

This was driving me nuts! I didn't get to even run a script once. But after removing all breakpoints on all files debugging actually starts to debug now.
Thanks!

@SydneyhSmith SydneyhSmith added Area-Debugging Issue-Bug A bug to squash. and removed Needs: Triage Maintainer attention needed! labels Nov 21, 2019
@SydneyhSmith
Copy link
Collaborator

@DarkLite1 thanks for opening this-- @TylerLeonhardt has a repro and is actively working on this

@TylerLeonhardt
Copy link
Member

For those of you having the issue, would you mind testing out this version? It should fix the issue.

PowerShell-insiders.vsix.zip

Let me know if you need help installing it.

@JustinGrote
Copy link
Collaborator

@TylerLeonhardt was just about to open a related issue for pester test debugging. Here's the repro and logs
Capture

ExtensionDiagLogs.zip

I'll test and check.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 22, 2019
@JustinGrote
Copy link
Collaborator

JustinGrote commented Nov 22, 2019

1574440280-681c2e52-1b1b-4349-8442-7913617615f01574440221069.zip
@TylerLeonhardt didn't seem to fix my issue FYI.

EDIT: Note I just have to restart the powershell session to get it working again, don't have to do a whole reload window.

EDIT2: Seems to be a bit inconsistent actually, right now it's working fine and not hanging, hmm...

EDIT3: Timeout issue maybe? Seems to happen if I leave it alone for a while. If I do a bunch in rapid succession they seem to work fine. Trying to get it consistent.

Name: PowerShell Preview
Id: ms-vscode.powershell-preview
Description: (Preview) Develop PowerShell scripts in Visual Studio Code!
Version: 2019.11.1
Publisher: Microsoft

Updated logs using your vsix:
image

@TylerLeonhardt
Copy link
Member

hmm @JustinGrote this could be specific to Pester debugging. I'll do some digging.

I do want to check to make sure @DarkLite1's issue (with regular non-Pester debugging) is fixed with that change I made.

@DarkLite1
Copy link
Author

DarkLite1 commented Nov 25, 2019

@TylerLeonhardt thanks for the effort but no, sadly it's still not working with your updated extension. What I can see is that the code is now executed 2 to 5 times without any issue, but after x tries of hitting F5 it gets stuck again.

On top of this my example is the most simplified version. Because I also noticed it running other files like Pester test files as indicated by @JustinGrote.

@TylerLeonhardt
Copy link
Member

Thanks @DarkLite1 - I'll try to replicate your environment to see if I can repro.

@TylerLeonhardt
Copy link
Member

@SeeminglyScience has a fix out for this. @SeeminglyScience if you wanna provide a test vsix for these folks, feel free to upload one.

@JustinGrote
Copy link
Collaborator

@TylerLeonhardt I dumped the artifacts from the build: https://dev.azure.com/powershell/PowerShellEditorServices/_build/results?buildId=39793 into my extensions module folder, and @SeeminglyScience's fix so far seems to be working for me. I ran it thru about 10-15 times and looking good so far. I'll stress test it tomorrow during development.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 26, 2019
@SydneyhSmith
Copy link
Collaborator

Closing as the PR to fix this issue has been merged: PowerShell/PowerShellEditorServices#1117

@SydneyhSmith SydneyhSmith added Resolution-Fixed Will close automatically. and removed Needs: Maintainer Attention Maintainer attention needed! labels Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Debugging Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants