PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.7k stars 488 forks source link

Powershell language extension fails to start #2066

Closed oliviermasson closed 5 years ago

oliviermasson commented 5 years ago

Hello Team,

Powershell extension fails to start Here are the output:

04/07/2019 09:57:30 [NORMAL] - Visual Studio Code v1.36.0 64-bit
04/07/2019 09:57:30 [NORMAL] - PowerShell Extension v2019.5.0
04/07/2019 09:57:30 [NORMAL] - Operating System: Windows 64-bit
04/07/2019 09:57:30 [NORMAL] - Language server starting --
04/07/2019 09:57:30 [NORMAL] -     exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
04/07/2019 09:57:30 [NORMAL] -     args: c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2019.5.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\logs\1562227050-53d91bb9-5b9e-4ea0-a715-20c07afa13ae1562226448387\EditorServices.log' -SessionDetailsPath 'c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\sessions\PSES-VSCode-16916-543076' -FeatureFlags @()
04/07/2019 09:57:35 [NORMAL] - powershell.exe started, pid: 18260
04/07/2019 09:59:30 [NORMAL] - Language server startup failed.
04/07/2019 09:59:30 [ERROR] - The language service could not be started: 
04/07/2019 09:59:30 [ERROR] - Timed out waiting for session file to appear.

I'm using the following Powershell env:

Name                           Value
----                           -----
PSVersion                      5.1.17134.765
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.765
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

I've tried unsuccessfully uninstall and reinstall the powershell extension

Thanks for you help

TylerLeonhardt commented 5 years ago

Thanks for the info! Can you also attach the logs here so we can get a better idea of what's going on?

oliviermasson commented 5 years ago

In Diagnostic mode, i don't have much more informations:

04/07/2019 18:18:56 [NORMAL] - Visual Studio Code v1.36.0 64-bit
04/07/2019 18:18:56 [NORMAL] - PowerShell Extension v2019.5.0
04/07/2019 18:18:56 [NORMAL] - Operating System: Windows 64-bit
04/07/2019 18:18:56 [NORMAL] - Language server starting --
04/07/2019 18:18:56 [NORMAL] -     exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
04/07/2019 18:18:56 [NORMAL] -     args: C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2019.5.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules' -EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath 'C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\logs\1562257136-b63b748a-9797-4b00-b52c-a65f1a046f471562257119645\EditorServices.log' -SessionDetailsPath 'C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\sessions\PSES-VSCode-21544-353576' -FeatureFlags @()
04/07/2019 18:19:01 [NORMAL] - powershell.exe started, pid: 4004
04/07/2019 18:19:15 [VERBOSE] - Formatting entire document - file:///c%3A/Users/masson/OneDrive%20-%20NetApp%20Inc/GitHub/svmtool/svmtools/svmtools.psm1...
04/07/2019 18:20:57 [NORMAL] - Language server startup failed.
04/07/2019 18:20:57 [ERROR] - The language service could not be started: 
04/07/2019 18:20:57 [ERROR] - Timed out waiting for session file to appear.

My log directory contains only a file with same info as above

PS C:\Users\masson\OneDrive - NetApp Inc\GitHub\svmtool> code -v
1.28.2
7f3ce96ff4729c91352ae6def877e59c561f4850
x64
PS C:\Users\masson\OneDrive - NetApp Inc\GitHub\svmtool> code --list-extensions --show-versions
ahmadawais.shades-of-purple@5.12.0
akamud.vscode-theme-onedark@2.1.0
alexcvzz.vscode-sqlite@0.7.1
andischerer.theme-atom-one-dark@0.0.1
atian25.copy-syntax@0.5.1
azemoh.one-monokai@0.3.7
azemoh.theme-onedark@0.5.2
batisteo.vscode-django@0.19.0
bibhasdn.django-html@1.3.0
bierner.markdown-preview-github-styles@0.1.6
christian-kohler.path-intellisense@1.4.2
codezombiech.gitignore@0.6.0
CoenraadS.bracket-pair-colorizer@1.0.61
DavidAnson.vscode-markdownlint@0.28.0
donjayamanne.githistory@0.4.6
donjayamanne.jupyter@1.1.5
donjayamanne.python-extension-pack@1.6.0
DotJoshJohnson.xml@2.5.0
dracula-theme.theme-dracula@2.18.0
eamodio.gitlens@9.8.2
Equinusocio.vsc-material-theme@29.2.0
esbenp.prettier-vscode@1.9.0
felixfbecker.php-debug@1.13.0
file-icons.file-icons@1.0.17
formulahendry.code-runner@0.9.11
formulahendry.terminal@0.0.10
GitHub.vscode-pull-request-github@0.8.0
humao.rest-client@0.21.3
idleberg.hopscotch@0.2.2
joshpeng.theme-onedark-sublime@0.3.7
liviuschera.noctis@9.7.0
magicstack.MagicPython@1.1.0
mortenhenriksen.perl-debug@0.6.0
ms-azuretools.vscode-docker@0.6.4
ms-kubernetes-tools.vscode-kubernetes-tools@1.0.1
ms-python.anaconda-extension-pack@1.0.1
ms-python.python@2019.6.22090
ms-vscode.cpptools@0.24.0
ms-vscode.csharp@1.20.0
ms-vscode.Go@0.11.1
ms-vscode.mono-debug@0.15.8
ms-vscode.powershell@2019.5.0
ms-vscode.Theme-MarkdownKit@0.1.4
p1c2u.docker-compose@0.3.4
redhat.vscode-yaml@0.4.1
riussi.code-stats-vscode@1.0.15
rogalmic.bash-debug@0.3.5
salbert.copy-text@0.4.3
Shan.code-settings-sync@3.3.1
shepelevstas.dumb-copy-paste@1.0.1
softwaredotcom.swdc-vscode@1.1.11
spmeesseman.vscode-taskexplorer@1.19.3
tht13.python@0.2.3
VisualStudioExptTeam.vscodeintellicode@1.1.7
vscode-icons-team.vscode-icons@8.8.0
vscoss.vscode-ansible@0.5.2
wholroyd.jinja@0.0.8
yzhang.markdown-all-in-one@2.4.0
zhuangtongfa.Material-theme@2.25.3
Zignd.html-css-class-completion@1.19.0

$psEditor return nothing

PS C:\Users\masson\OneDrive - NetApp Inc\GitHub\svmtool> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17134.765
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.765
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

HTH

oliviermasson commented 5 years ago

Here is what i got when i open powershell log folder

image

As you can see this folder does not contain any EditorServices.log file, only vscode-powershell.log, with same information as displayed above

Regards

TylerLeonhardt commented 5 years ago

Do you have any GPO rules in place that this machine is a part of?

rkeithhill commented 5 years ago

Does this yield any events that happened at the same time you attempted to launch the extension?

Get-EventLog -LogName Application -EntryType Error -Newest 10 | Where Source -match 'Application|\.NET' | Format-List *
oliviermasson commented 5 years ago

Yes my laptop is managed by my company, so GPO are in place. But this is the case since few years, and i use VS with powershell extension since few years without any trouble. I could check with my IT, but i'm not aware of any change in our GPO.

Here are the event log during my issue. As you will see, nothing relative with VS:

PS C:\Users\masson> Get-EventLog -LogName Application -EntryType Error -Newest 10 | Where Source -match 'Application|\.NET' | Format-List *

EventID            : 1000
MachineName        : MASSON-PC.hq.netapp.com
Data               : {}
Index              : 119874
Category           : Application Crashing Events
CategoryNumber     : 100
EntryType          : Error
Message            : Faulting application name: MobaSCP.exe, version: 0.42.0.0, time stamp: 0x5ae598a2
                     Faulting module name: ntdll.dll, version: 10.0.17134.799, time stamp: 0x636bcb43
                     Exception code: 0xc0000005
                     Fault offset: 0x00043654
                     Faulting process id: 0x50e4
                     Faulting application start time: 0x01d531acdeca270a
                     Faulting application path: C:\Users\masson\DOCUME~1\MobaXterm\slash\bin\MobaSCP.exe
                     Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
                     Report Id: 3e02111e-5e68-451b-894f-8e4f59ebc09a
                     Faulting package full name:
                     Faulting package-relative application ID:
Source             : Application Error
ReplacementStrings : {MobaSCP.exe, 0.42.0.0, 5ae598a2, ntdll.dll...}
InstanceId         : 1000
TimeGenerated      : 03/07/2019 16:37:42
TimeWritten        : 03/07/2019 16:37:42
UserName           :
Site               :
Container          :

EventID            : 1000
MachineName        : MASSON-PC.hq.netapp.com
Data               : {}
Index              : 119872
Category           : Application Crashing Events
CategoryNumber     : 100
EntryType          : Error
Message            : Faulting application name: MobaSCP.exe, version: 0.42.0.0, time stamp: 0x5ae598a2
                     Faulting module name: ntdll.dll, version: 10.0.17134.799, time stamp: 0x636bcb43
                     Exception code: 0xc0000005
                     Fault offset: 0x00043654
                     Faulting process id: 0x3b9c
                     Faulting application start time: 0x01d531a92f2caec9
                     Faulting application path: C:\Users\masson\DOCUME~1\MobaXterm\slash\bin\MobaSCP.exe
                     Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
                     Report Id: 79c97ef4-3820-4bee-a2a6-d36e0b35d187
                     Faulting package full name:
                     Faulting package-relative application ID:
Source             : Application Error
ReplacementStrings : {MobaSCP.exe, 0.42.0.0, 5ae598a2, ntdll.dll...}
InstanceId         : 1000
TimeGenerated      : 03/07/2019 16:11:19
TimeWritten        : 03/07/2019 16:11:19
UserName           :
Site               :
Container          :
oliviermasson commented 5 years ago

I don't know if it's relative to my issue, but the error message when VS try to open a Powershell Integrated Console refer to a session timedout.

When i'm trying to open New Terminal VS succefully and quickly open a powershell termninal, without any issue:

image

TylerLeonhardt commented 5 years ago

@olivermasson can you try this troubleshooting step for restricted systems and let us know if that helps?

oliviermasson commented 5 years ago

Hi @TylerLeonhardt

I've followed the troubleshooting step for restricted systems, and now I can tell you that there doesn't seem to be any GPO that prevents the import of the module, nor a signature problem, see next screenshot:

image

And it's the same for this module: image

HTH

oliviermasson commented 5 years ago

If it could help, i run Start-EditorServices.ps1 manualy. Here is the output:

PS C:\Users\masson\OneDrive - NetApp Inc\GitHub\svmtool> c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2019.5.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules' -EnableConsoleRepl
-LogLevel 'Diagnostic' -LogPath 'c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\logs\testom_EditorServices.log' -SessionDetailsPath 'c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\sessions\PSES-VSCode-16916-543076' -FeatureFlags @()
VERBOSE: 
#-- Removing PSReadLine module -----------------------------------------------
VERBOSE: Removing the imported "PSConsoleHostReadline" function.
VERBOSE: 
#-- Console Encoding ---------------------------------------------------------
VERBOSE: System.Text.ASCIIEncoding
VERBOSE: 
#-- Updated PSModulePath to: -------------------------------------------------
VERBOSE: 
VERBOSE: C:\Users\masson\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\PowerShell
VERBOSE: C:\Program Files (x86)\WindowsPowerShell\Modules
VERBOSE: C:\Program Files\WindowsPowerShell\Modules
VERBOSE: C:\windows\system32\WindowsPowerShell\v1.0\Modules
VERBOSE: 
VERBOSE: C:\Program Files (x86)\NetApp\NetApp PowerShell Toolkit\Modules\.
VERBOSE: C:\Program Files (x86)\NetApp\NetApp PowerShell Toolkit\Modules\
VERBOSE: c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules
VERBOSE: 
#-- Check required modules available -----------------------------------------
VERBOSE: Testing module availability PowerShellGet 
VERBOSE: Loading module from path 'C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1'.
VERBOSE: PowerShellGet  found
VERBOSE: 
#-- Start up PowerShellEditorServices ----------------------------------------
VERBOSE: Importing PowerShellEditorServices
VERBOSE: Loading module from path 'C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'.
VERBOSE: Importing function 'Compress-LogDir'.
VERBOSE: Importing function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Start-EditorServicesHost'.
PowerShell Integrated Console

VERBOSE: Invoking Start-EditorServicesHost
VERBOSE: Start-EditorServicesHost returned Microsoft.PowerShell.EditorServices.Host.EditorServicesHost
VERBOSE: Writing session file with contents:
VERBOSE: {"languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_nho314zo.uw0","debugServiceTransport":"NamedPipe","status":"started","debugServicePipeName":"\\\\.\\pipe\\PSES_zkwbkajy.yb4"}
VERBOSE: Wrote out session file
VERBOSE: 
#-- Waiting for EditorServicesHost to complete execution ---------------------

And Logfile testom_EditorServices.log contains following output:

2019-07-08 10:26:37.675 [NORMAL] tid:14 in 'StartLogging' C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: line 183

    PowerShell Editor Services Host v1.12.1.0 starting (PID 9336

      Host application details:

        Name:      Visual Studio Code Host
        Version:   2019.5.0
        ProfileId: Microsoft.VSCode
        Arch:      X64

      Operating system details:

        Version: Microsoft Windows 10.0.17134 
        Arch:    X64

      Build information:

        Version: <development-build>
        Origin:  <development>
        Date:    2019-05-28T17:56:01

2019-07-08 10:26:37.699 [NORMAL] tid:14 in 'StartLanguageService' C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: line 202
    Language service started, type = NamedPipe, endpoint =  InOut pipe: PSES_nho314zo.uw0

2019-07-08 10:26:37.706 [NORMAL] tid:14 in 'StartDebugService' C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: line 279
    Debug service started, type = NamedPipe, endpoint =  InOut pipe: PSES_zkwbkajy.yb4
rjmholt commented 5 years ago

Do you know when this issue started occurring? Was it followed by a PowerShell extension update, or maybe a Windows update or possibly after a VSCode update?

oliviermasson commented 5 years ago

Hello Robert,

I'm not sure, because I haven't used it in almost a month. I know that when I restarted VS code, there was an update of VS. I don't know if there have been any updates to the plugin. I think there have been updates on my OS.

For the record, I have another PC (which is not managed by my company) and for which, the powershell plugin runs correctly. Here is the information for this PC:

Version: 1.36.0 (user setup)
Commit: 0f3794b38477eea13fb47fbe15a42798e6129338
Date: 2019-07-03T13:25:46.372Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.17763
PS D:\Olivier\Telechargement\svmtool-master> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17763.503
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.503
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
PS D:\Olivier\Telechargement\svmtool-master> code --list-extensions --show-versions
ms-vscode.powershell@2019.5.0

Hope this could help. Thank you

SydneyhSmith commented 5 years ago

@oliviermasson sorry you are hitting this issue, it is difficult for us to identify the cause but I think the best option is to make sure you have a clean, up-to-date environment:

Uninstall VSCode rm -fo -r ~.vscode Install any pending Windows updates Restart your machine Install VSCode Install the PowerShell extension Check for the bug If it persists, Install VSCode Insiders Install the PowerShell extension in VSCode insiders

If the bug's still there at that point, turn on diagnostic logging and upload your logs here. Particularly of interest would be the terminal's execution trace from the startup script. If we still find nothing, I would suspect security policy or some kind of system lockdown that causes PowerShell to lock up when trying to execute some step. Antivirus software sometimes likes to silently stop execution in our startup script

oliviermasson commented 5 years ago

HI @SydneyhSmith

unfortunately uninstalling and completely re-installing vscode or vscode insiders as you told me does not fix the problem. Is there not a way to have a little more verbosity in the WaitForCompletion() function? Because it is precisely in this function that the problem occurs, at line 456 of Start-EditorServices.ps1 image

While the Language service and Debug service seem to be started correctly, as indicated in the logs:

2019-07-12 18:14:14:16.502[NORMAL] tid:16 in'StartLanguageService' C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: line 202
    Language service started, type = NamedPipe, endpoint = InOut pipe: PSES_th3pdf5q.zao

2019-07-12 18:14:14:16.515[NORMAL] tid:16 in'StartDebugService' C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: line 279
    Debug service started, type = NamedPipe, endpoint = InOut pipe: PSES_mupq5edj.5c0

Thanks in advance

rjmholt commented 5 years ago

WaitForCompletion is here. It's a hook in the startup script where it waits for the language server to fire an event before it shuts down; if you're busy using the extension, you don't want that method to return because it means the extension is shutting down.

The actual problem lies elsewhere.

We've had a bunch of startup issues recently, seemingly brought on by updates in VSCode or Windows (we haven't released an update recently and haven't had reports of issues on *nix or recent Windows versions). This class of problems seems to occur at some deeper level and its not clear how to get more information, but possibly collecting a dump and collecting fusion logs are the next steps. We've seen it occur on less recent Windows versions, and Windows systems with some kind of lockdown or policy applied. If you have an antivirus installed, you should check any logs it provides to see if it's silently blocking something.

Could you provide the name and version of your operating system as well? Hopefully we can identify a pattern in startup hang reports based on that.

oliviermasson commented 5 years ago

Hello @rjmholt ,

I don't have antivirus software on my laptop, but certainly something worse in terms of locking and it's called avecto defendpoint. But despite this and for more than a year, vscode and all its extensions (including powershell) worked perfectly. Watching event log, i can't notice any warning or error relative to powershell or any locks. On the contrary, I only note that Start-EditorServices.ps1 successfully registered in engine lifecycle event

Engine state is changed from None to Available. 

Details: 
    NewEngineState=Available
    PreviousEngineState=None

    SequenceNumber=13

    HostName=ConsoleHost
    HostVersion=5.1.17134.765
    HostId=1878c1b1-2439-421f-87d1-9b3edc2b64e1
    HostApplication=C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command & 'c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\Start-EditorServices.ps1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2019.5.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\logs\1563262501-28be5587-8c01-48c5-a96f-e78163b665461563262453343\EditorServices.log' -SessionDetailsPath 'c:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\sessions\PSES-VSCode-32036-868847' -FeatureFlags @()
    EngineVersion=5.1.17134.765
    RunspaceId=20894c42-1f42-4e72-a9d4-5313f7489ecf
    PipelineId=
    CommandName=
    CommandType=
    ScriptName=
    CommandPath=
    CommandLine=

My Windows version is image

And My powershell env is:

PS C:\Users\masson\OneDrive - NetApp Inc\GitHub\svmtool> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17134.765
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.765
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

I'm trynig to collect fusion logs and dump. But regarding dump, as there is no real crash, i'm not sure it will collect something.

But i'll keep you updated. Thank you

oliviermasson commented 5 years ago

Please find the fusion.log collected during my issue fusionlog.zip

oliviermasson commented 5 years ago

As I suspected, our problem does not generates application dump.

rjmholt commented 5 years ago

Admittedly this issue and others like it are stumping us a bit.

One thing would be to try the preview version of the extension, powershell-preview in the marketplace.

The next suggestion would be to add logging statements to the ps1 and psm1 files. You should be able to just edit it at ~/.vscode/extensions/ms-vscode.powershell-2019.5.0/modules/PowerShellEditorServices/PowerShellEditorServices.psm1 (also Start-EditorServices.ps1 is in the same directory).

My guess is that something is stopping PowerShell from progressing at some point and the only way to know where the problem occurs is to see where it stops printing.

We'll look into adding more logging to the start script in the near term, and hopefully we can identify a way to stop this from happening.

oliviermasson commented 5 years ago

Hi @rjmholt

I've tried the preview version of extension, but issue is still there. I'm trying to log as much as possible Will keep you updated as soon as possible

FYI my laptop as been upgraded to a new Windows version image

image

But issue is still there

oliviermasson commented 5 years ago

Certainly something beyond my knownledge, but I wonder if the problem is not in the way VScode starts a new Terminal "Powershell Integrated Console" rather than in the code of the Language Editor Service itself. Indeed, if I manually start a new terminal through: image

And that, if in this one I execute the same command to start the language service. By using the same session path Force loglevel to Diagnostic And set a new log folder

All like this:

C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2019.5.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules' -EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath 'C:\Users\masson\EditorServices.log' -SessionDetailsPath 'C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\sessions\PSES-VSCode-22796-494317' -FeatureFlags @()

Then I don't seem to have any problem, at least up to the write session file. PS : I have added some basic Logging in the code of Start-EditorServices.ps1:

PS C:\Users\masson\OneDrive - NetApp Inc\GitHub\svmtool> C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2019.5.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules' -EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath 'C:\Users\masson\EditorServices.log' -SessionDetailsPath 'C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\sessions\PSES-VSCode-22796-494317' -FeatureFlags @()
VERBOSE: Start-EditorServices
VERBOSE: EditorServices.log
VERBOSE: 
#-- Removing PSReadLine module -----------------------------------------------
VERBOSE: Removing the imported "PSConsoleHostReadLine" function.
VERBOSE: 
#-- Console Encoding ---------------------------------------------------------
VERBOSE: System.Text.ASCIIEncoding
VERBOSE: 
#-- Updated PSModulePath to: -------------------------------------------------
VERBOSE: 
VERBOSE: C:\Users\masson\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\PowerShell
VERBOSE: C:\Program Files (x86)\WindowsPowerShell\Modules
VERBOSE: C:\Program Files\WindowsPowerShell\Modules
VERBOSE: C:\windows\system32\WindowsPowerShell\v1.0\Modules
VERBOSE: 
VERBOSE: C:\Program Files (x86)\NetApp\NetApp PowerShell Toolkit\Modules
VERBOSE: C:\Program Files (x86)\NetApp\NetApp PowerShell Toolkit\Modules\
VERBOSE: C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules
VERBOSE: 
#-- Check required modules available -----------------------------------------
VERBOSE: Testing module availability PowerShellGet 
VERBOSE: Loading module from path 'C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1'.
VERBOSE: PowerShellGet  found
VERBOSE: 
#-- Start up PowerShellEditorServices ----------------------------------------
VERBOSE: Importing PowerShellEditorServices
VERBOSE: Loading module from path 'C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'.
VERBOSE: Loading module from path 'C:\Users\masson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\PowerShellEditorServices.psm1'.
VERBOSE: Exporting function 'Start-EditorServicesHost'.
VERBOSE: Exporting function 'Log'.
VERBOSE: Exporting function 'Compress-LogDir'.
VERBOSE: Exporting function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Compress-LogDir'.
VERBOSE: Importing function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Start-EditorServicesHost'.
PowerShell Integrated Console

VERBOSE: Invoking Start-EditorServicesHost
VERBOSE: Default mode
VERBOSE: Start-EditorServicesHost returned 

Status : Started

VERBOSE: Write session file with 

Name  : languageServiceTransport
Value : NamedPipe

Name  : languageServicePipeName
Value : \\.\pipe\PSES_cqck1yho.g3c

Name  : debugServiceTransport
Value : NamedPipe

Name  : status
Value : started

Name  : debugServicePipeName
Value : \\.\pipe\PSES_pqfxfxmn.cok

VERBOSE: Writing session file with contents:
VERBOSE: {"languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_cqck1yho.g3c","debugServiceTransport":"NamedPipe","status":"started","debugServicePipeName":"\\\\.\\pipe\\PSES_pqfxfxmn.cok"}
VERBOSE: Wrote out session file
VERBOSE: 
#-- Waiting for EditorServicesHost to complete execution ---------------------

Of course, in this kind of execution mode, I don't have a functional extension either. I stay indefinitely on the message "Waiting for EditorServicesHost to complete execution..."... But maybe this is normal and due to the fact that I manually launched the extension?

Anyway, if the problem is elsewhere, I don't see how to add more log, the rest of the code is in the form of .DLL, so i can't add any Log inside. Or i don't knwo how to do it???

As a reminder, when VScode automatically starts this extension, the error seems to be around the possibility of writing the session file: image

This problem is very impacting in my developments because I no longer have access to the debugger.

Thanks in advance.

rjmholt commented 5 years ago

@oliviermasson I'm going to deduplicate this issue to https://github.com/PowerShell/vscode-powershell/issues/2014. I've posted a comment in there about collecting more information.

rjmholt commented 3 years ago

Linking this to https://github.com/PowerShell/vscode-powershell/issues/3077, where I'm following up with BeyondTrust