Vscode-powershell: Script fails to run on second run

Created on 20 Nov 2019  路  11Comments  路  Source: PowerShell/vscode-powershell

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
Area-Debugging Issue-Bug Resolution-Fixed

Most helpful comment

@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.

All 11 comments

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!

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

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.

@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.

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

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.

@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.

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

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

@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.

Closing as the PR to fix this issue has been merged: https://github.com/PowerShell/PowerShellEditorServices/pull/1117

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daviwil picture daviwil  路  4Comments

nathan-alden-hp picture nathan-alden-hp  路  3Comments

GQnzo picture GQnzo  路  3Comments

AWahlqvist picture AWahlqvist  路  3Comments

guidooliveira picture guidooliveira  路  3Comments