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

When debugging a powershell script, every 2 times the debugger stops. #1119

Closed
Frickeldave opened this issue Dec 7, 2017 · 10 comments
Closed

Comments

@Frickeldave
Copy link

System Details

  • Operating system name and version: CentOS Standard 7.4.1708
  • VS Code version: 1.18.1
  • PowerShell extension version: 1.5.1
  • Output from $PSVersionTable:
    PSVersion 6.0.0-rc
    PSEdition Core
    GitCommitId v6.0.0-rc
    OS Linux 3.10.0-693.5.2.el7.x86_64 Create Yeoman generator for PowerShell projects #1 SMP Fri Oct 20 20:32:50 UTC 2017
    Platform Unix
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1
    WSManStackVersion 3.0
Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:

code -v
_1.18.1
929bacba01ef658b873545e26034d1a8067445e9_
$pseditor.EditorServicesVersion = 1.5.1.0
code --list-extensions --show-versions = [email protected]

Issue Description

When debugging a powershell script, every 2 times the debugger stops. I describes the exact behavior and steps to reproduce.

_Steps to reproduce:
1: Install vscode
1a: sudo yum install wget
1b: wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0_rc-1.rhel.7.x86_64.rpm
1c: sudo yum install powershell-6.0.0_rc-1.rhel.7.x86_64.rpm
2: Start code
3: Install Powershell extensions
4: Start debugging with F5 (PowerShell Launch Current File)
5: step through your code with F10/F11
6: Every 2nd line he stops going forward. Then you have to click into the terminal and press "Enter". Than you can go back into the editor window and go forward with F10/F11._

I am experiencing a problem with...

@tlisiecki
Copy link

Hi.
I am experiencing the very same problem and quite accidentally discovered that pressing Enter in Powershell Integrated Console does actually resume the debugger.

This is pretty infuriating ;D

liske@opnsse8440:~> code -v
1.18.1
929bacba01ef658b873545e26034d1a8067445e9
PS /home/liske/> $pseditor.EditorServicesVersion
Major  Minor  Build  Revision
-----  -----  -----  --------
1      5      1      0
PS /home/liske/> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-rc
PSEdition                      Core
GitCommitId                    v6.0.0-rc
OS                             Linux 4.14.0-1-default #1 SMP PREEMPT Mon Nov 13 21:02:46 UTC 2017 (ab9e909)
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

What can we do to help investigate that issue?

@SeeminglyScience
Copy link
Collaborator

This issue is being tracked in #987, #1107 and PowerShell/PowerShellEditorServices#554

There's a PR open to fix the issue here

@tlisiecki @davidkoenig09 If you're feeling adventurous and would like to give us a hand testing out the potential fix, here's the build from appveyor

@tlisiecki
Copy link

Hi @SeeminglyScience . Thanks for the update. Im surely up for some testing, unfortunately cant really find out what to do with that attached file. Tried to find an analogous item on my installation but failed... Can you please point me to some info?

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Jan 4, 2018

@SeeminglyScience the appveyor download when on macOS has some path troubles - \ vs /😞
screen shot 2018-01-04 at 9 25 31 am

I don't think Travis gives us anything, does it?

@tlisiecki can you confirm that you see the same thing when you extract the zip?

What we want to do is replace the folder ~/.vscode/extensions/ms-vscode.powershell-1.5.1/modules/PowerShellEditorServices with the folder you just downloaded.

@tlisiecki
Copy link

@tylerl0706 Thanks for help, that explains all.
About the directory separator - yes it seems what is there in the archive is a flat list of files that includes "" in a filename instead of nested directories structure. Wondering how did that happen :S

image

@TylerLeonhardt
Copy link
Member

Probably a result of zipping on Windows, unzipping on linux. I can look at that in a bit.

In the short term, if you have a windows machine available you can probably unzip it there and transfer the folder over... or zip it correctly and transfer the zip over

@SeeminglyScience
Copy link
Collaborator

Ah yeah, I saw it displaying differently in Ubuntu if I built on Windows. But the default Extract here context menu item figured out the directory structure without issue so I didn't give it much thought. Must be some distro specific fool proofing :)

@tlisiecki
Copy link

Hi @SeeminglyScience , @tylerl0706 .
Yeah in my case it was KDE`s ARK that failed so miserably. commandline unzip worked way better.

liske@localhost:~/Downloads> unzip -q PowerShellEditorServices-1.5.1-1001.zip -d PowerShellEditorServices-1.5.1-1001 warning: PowerShellEditorServices-1.5.1-1001.zip appears to use backslashes as path separators
After unzipping I made backups of my current modules (renamed the dirs) and copied PowerShellEditorServices and PowerShellEditorServices.VSCode into /home/liske/.vscode/extensions/ms-vscode.powershell-1.5.1/modules/ and then copied Start-EditorServices.ps1 into /home/liske/.vscode/extensions/ms-vscode.powershell-1.5.1/scripts/.

After that I started VSCode and opened powershell script. Powershell Integrated Console started but failed with an exception I couldn`t read casuse the terminal disappeared very quickly.

From powershell extension Logs Output I found out that Start-EditorServices.ps1 with a set of arguments was executed, so I actually tried to run that by hand with the following exception (unrecognized arguments in new version of Start-EditorServices.ps1)

PS /home/liske/.vscode/extensions/ms-vscode.powershell-1.5.1/scripts> ./Start-EditorServices.ps1 /home/liske/.vscode/extensions/ms-vscode.powershell-1.5.1/scrip ts/Start-EditorServices.ps1 -EditorServicesVersion '1.5.1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.1' -Additiona lModules @('PowerShellEditorServices.VSCode') -BundledModulesPath '/home/liske/.vscode/extensions/ms-vscode.powershell-1.5.1/modules' -EnableConsoleRepl -LogLev el 'Normal' -LogPath '/home/liske/.vscode/extensions/ms-vscode.powershell-1.5.1/logs/1515102930-bd036468-1dee-4fad-82bd-8ca7eae91d3a1515102924307/EditorServices .log' -SessionDetailsPath '/home/liske/.vscode/extensions/ms-vscode.powershell-1.5.1/sessions/PSES-VSCode-10989-716872' -FeatureFlags @() /home/liske/.vscode/extensions/ms-vscode.powershell-1.5.1/scripts/Start-EditorServices.ps1 : A positional parameter cannot be found that accepts argument '/home/liske/.vscode/extensions/ms-vscode.powershell-1.5.1/scripts/Start-EditorServices.ps1'. At line:1 char:1 ./Start-EditorServices.ps1 /home/liske/.vscode/extensions/ms-vscode.p ... CategoryInfo : InvalidArgument: (:) [Start-EditorServices.ps1], ParameterBindingException FullyQualifiedErrorId : PositionalParameterNotFound,Start-EditorServices.ps1 PS /home/liske/.vscode/extensions/ms-vscode.powershell-1.5.1/scripts>

Now things get a lot much better when I rolled back to old Start-EditorServices.ps1 while keeping new versions of PowerShellEditorServices and PowerShellEditorServices.VSCode.
Powershell integrated Console started normally and most importantly debugging was possible. Also the debugger was no longer stopping every 2 lines.

@SeeminglyScience
Copy link
Collaborator

@tylerl0706 I missed this one in the PR, if you could close please :)

@TylerLeonhardt
Copy link
Member

Closing as fixed in the version shipping this week!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants