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

VS Code PowerShell debugging fails in flight mode #1105

Closed
weinand opened this issue Nov 17, 2017 · 12 comments
Closed

VS Code PowerShell debugging fails in flight mode #1105

weinand opened this issue Nov 17, 2017 · 12 comments

Comments

@weinand
Copy link

weinand commented Nov 17, 2017

From @markgossa on November 17, 2017 3:12

  • VSCode Version: Code 1.18.0 (dcee2202709a4f223185514b9275aa4229841aa7, 2017-11-08T21:22:49.932Z)
  • OS Version: Windows_NT x64 10.0.16299
  • Extensions:
Extension Author (truncated) Version
vscode-github Kni 0.23.0
PowerShell ms- 1.5.1

Steps to Reproduce:

  1. Put laptop into flight mode
  2. Create a new PowerShell file, save as .ps1
  3. Press F5 or F8 to run the code

It just says "Starting PowerShell" in the bottom right and doesn't start it then times out.

Reproduces without extensions: Yes

Copied from original issue: microsoft/vscode#38576

@TylerLeonhardt
Copy link
Member

Just so we're on the same page here. @markgossa, "flight mode" is the same as "airplane mode"?

@markgossa
Copy link

Hi @tylerl0706, yes. It's basically having no internet access. I think it needs access yo a particular URL to start PowerShell which I found out when I tried to use VSCode on my flight :-)

@rkeithhill
Copy link
Collaborator

I don't think the extension needs external access however it does use a socket to talk to the out-of-process PowerShellEditorServices module. That module provides the language and debugging services. You can see this from the VSCode-powershell.log file:

11/28/2017 11:28:57 AM [NORMAL] - {"debugServicePort":12619,"status":"started","channel":"tcp","languageServicePort":25096}
11/28/2017 11:28:57 AM [NORMAL] - Connecting to language service on port 25096...
11/28/2017 11:28:57 AM [NORMAL] - Language service connected.

But this is a localhost socket so not sure why airplane mode would disable it. Can you put your laptop in airplane mode and see if this PowerShell script works:

https://github.com/PowerShell/PowerShellEditorServices/blob/01b1a14f23dab69ae9be51e8c5bf3af31dcb0b7e/module/Start-EditorServices.ps1#L80-L117

Try calling Get-AvailablePort and see if it works (or not).

@rkeithhill
Copy link
Collaborator

@daviwil
Copy link
Contributor

daviwil commented Nov 30, 2017

You can certainly give that a shot. I've also been skeptical of the port availability check in Start-EditorServices.ps1, something I'm doing there might be causing initialization to fail early.

@markgossa
Copy link

Hi @rkeithhill, I ran the Get-AvailablePort with or without an internet connection and it gives me a random port both times.

@rkeithhill
Copy link
Collaborator

Thanks for testing that. I can't repro the problem and I'm on Windows 10 16299 as well. :-(

@markgossa
Copy link

@rkeithhill - thanks for the reply and apologies for the delay in getting back to you.

I've just confirmed the issue on another one of my Windows 10 machines. This time running 1703 build 15063.

To reproduce it:

  1. Make sure VSCode is closed
  2. Disconnect or disable all network connections or enter flight mode
  3. Open up VSCode
  4. Create a new file and set the language mode to PowerShell

You should see a notification in bar at the bottom saying "Starting PowerShell" but it never does.

Session logs are below:

2017-12-7 20:50:15 [NORMAL] - Path specified by 'powerShellExePath' setting - '' - not found, reverting to default PowerShell path.
2017-12-7 20:50:15 [NORMAL] - Language server starting --
2017-12-7 20:50:15 [NORMAL] - exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
2017-12-7 20:50:15 [NORMAL] - args: C:\Users\mark.vscode\extensions\ms-vscode.powershell-1.5.1\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.5.1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\mark.vscode\extensions\ms-vscode.powershell-1.5.1\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\mark.vscode\extensions\ms-vscode.powershell-1.5.1\logs\1512679815-7a7bcc38-a506-4a8e-bb59-0f6e66d28ea61512679810574\EditorServices.log' -SessionDetailsPath 'C:\Users\mark.vscode\extensions\ms-vscode.powershell-1.5.1\sessions\PSES-VSCode-8692-677029' -FeatureFlags @()
2017-12-7 20:50:15 [NORMAL] - powershell.exe started, pid: 10280
2017-12-7 20:50:18 [NORMAL] - Language server started.
2017-12-7 20:50:18 [NORMAL] - {"debugServicePort":27980,"status":"started","channel":"tcp","languageServicePort":18241}
2017-12-7 20:50:18 [NORMAL] - Connecting to language service on port 18241...

I can connect to localhost on this port using Test-NetConnection using the IPv4 loopback address 127.0.0.1 but not the IPv6 loopback address ::1

Let me know what you find or if you have more diagnostics you want me to run.

@markgossa
Copy link

@rkeithhill @daviwil - I found that if I create a loopback adapter then everything works fine when offline. Potentially this will help troubleshooting but it's a good workaround for me for now.

@rkeithhill
Copy link
Collaborator

@markgossa We made a change in 1.7.0 that we hope will fix this scenario. Any chance you could try to repro the issue with this version of the extension?

@rkeithhill
Copy link
Collaborator

The switch to using named pipes in the next release should fix this issue - see #1327

@TylerLeonhardt
Copy link
Member

Closing this because of what Keith said 😄

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

5 participants