Closed QuyenLy73 closed 4 years ago
1/14/2020 2:47:41 PM [NORMAL] - Language server startup failed. 1/14/2020 2:47:41 PM [ERROR] - The language service could not be started: 1/14/2020 2:47:41 PM [ERROR] - Timed out waiting for session file to appear.
These logs just indicate that the client waited for the server to start and that it didn't. When you try to start the PowerShell extension, does anything flash in the terminal? Unfortunately, because of the way VSCode works, capturing the screen at that moment (like with a video/gif recorder) might be the only way to get any error message there.
I have also executed this command but nothing happens.
You might also have some luck trying to execute the following from cmd:
powershell.exe -NoProfile -NoLogo -ExecutionPolicy Bypass -Command "$PSES_BUNDLE_PATH/PowerShellEditorServices/Start-EditorServices.ps1 -BundledModulesPath $PSES_BUNDLE_PATH -LogPath $SESSION_TEMP_PATH/logs.log -SessionDetailsPath $SESSION_TEMP_PATH/session.json -FeatureFlags @() -AdditionalModules @() -HostName 'My Client' -HostProfileId 'myclient' -HostVersion 1.0.0 -LogLevel Diagnostic"
With the following set inline:
$PSES_BUNDLE_PATH
: ~\.vscode\extensions\ms-vscode.powershell-2019.12.0\modules
$SESSION_TEMP_PATH
: An empty temp directoryIf that works, it should print a bunch of information and then block at the point where it waits for a client to connect (you should then kill the process, since there won't be a client to connect). If it doesn't work (which is what I'm hoping, since we need to reproduce this error in an environment where we control the terminal process), then you should see the error in the CMD console.
The cursor just blinks like it's waiting for something?
The cursor just blinks like it's waiting for something?
Is this in the Integrated Console after startup? It might be worth trying pressing Enter or entering some input there.
Also see if you're able to run the other command listed above.
Actually looks like I didn't wait long enough. There are now 3 files in my temp directory. logs.ext, Start-EditorServices-logs.txt, and session.json. In the Integrated Console in VSCode, the last status is
In the Integrated Console in VSCode, the last status is
-- Waiting for EditorServicesHost to complete execution ---------------------
That means it should be ready to go. Do you get a prompt?
The PS Integrated Console does not let me type anything in there. It tries to start up with a Starting Powershell message and eventually throws an initialization error which is the Language server startup error that I posted here. I ran the command in a different Powershell terminal session within VS code. I assume this is just the PS on the OS. In this window, I get the Waiting for EditorServicesHost message but I can't type anything after that message. I'm still not able to run any of my PS scripts from within VSCode because it says Cannot Debug or Run Powershell Script until the Powershell session has started.
There are now 3 files in my temp directory. logs.ext, Start-EditorServices-logs.txt, and session.json
Can you post those files here? (Or send them through by email: see the troubleshooting doc)
I assume this is just the PS on the OS
That's indeed what that is.
From what you've described so far, it sounds like the PowerShell process that runs the server is correctly getting to the point where it's waiting on a client connection but for some reason the client never connects properly. If the logs don't reveal anything, it might be worth trying the preview extension instead, especially since that will be stable within the month.
Files uploaded. Where do I get the preview extension? I've tried rolling back to an older version but still same issue.
Where do I get the preview extension?
It's in the VSCode marketplace as powershell-preview
. You'll need to uninstall the powershell
extension for it to work properly.
Unfortunately same issue with the preview version. Might try uninstalling VSCode and re-install.
Re-installing VSCode didn't help.
Can you post of a GIF of the whole VSCode window as the extension starts up?
The other thing I noticed is that the Windows version you're using (RS3) may be end-of-life. Sometimes these kinds of hang issues that we can't reproduce are caused by changes in Windows fixed by patches.
The terminal is blank with a Starting Powershell... message at the bottom right. Are you wanting a screenshot of the Output window? Unfortunately I can't control the Windows version. This machine is my work laptop. The Powershell extension is a Microsoft product correct? My next route will have to be to submit a ticket to MS if I can't figure this out myself soon.
Are you wanting a screenshot of the Output window?
A GIF/video of the startup would be ideal, something that shows the extension load when the first PowerShell file is opened and then the Integrated Console appear and start, right until the last message that you posted earlier is logged. It might not show any new information, but sometimes there's a clue in the greater VSCode window.
Unfortunately I can't control the Windows version. This machine is my work laptop.
In that case I believe RS3 is good until April. But in an enterprise context, sometimes anti-virus or group policy prevent startup. It's not entirely clear how we'd show that, but some users have found they can reproduce the same issue on various work devices with different Windows and PowerShell versions, while also having no problem starting the extension on personal devices. If you find that's the case, we'd be grateful for any data you can provide since this is something that crops up from time to time but is very hard to reproduce.
The Powershell extension is a Microsoft product correct?
This is indeed software developed, maintained and made available by Microsoft. I am a Microsoft engineer.
This was working fine before the holiday break. I upgraded to the latest extension recently so not sure what triggered the issue. Could very well be Windows hotfix, GPO, etc... I just need to figure out what exactly. I can try and record VSCode but it pretty much shows me a blank terminal window while it's starting up. I don't see anything else.
Any advice on what specific group policy to look for? Isn't this just trying to run a PS script behind the scenes? ie Start-EditorServices.ps1?
This was working fine before the holiday break. I upgraded to the latest extension recently so not sure what triggered the issue.
Yeah we've heard similar in other cases. Often it seems the extension hasn't changed, or even VSCode (since they're totally separate). But one day it just stops working. Possibly a Windows patch, perhaps more likely a policy rollout.
Isn't this just trying to run a PS script behind the scenes? ie Start-EditorServices.ps1?
Yeah, VSCode starts a child process like powershell.exe -noprofile -nologo -command 'C:\path\to\Start-EditorServices.ps1 ... <parameters for connecting, like named pipe name>'
I can try and record VSCode but it pretty much shows me a blank terminal window while it's starting up. I don't see anything else.
In the absence of other information it could be helpful. It likely won't shed new light, but sometimes there's a clue.
Any advice on what specific group policy to look for?
Unfortunately I don't know very much about GPO or how exactly it could interact with the extension, just that some other users have reported it doing so. I'll try and do some research on it. In the meantime, this issue is marked for triage so I'll discuss it with some other team members tomorrow.
At the point the extension seems to be stuck, the server has created an ACL'd named pipe and the client should be connecting over that named pipe
Hopefully you'll have some more ideas after speaking with your team members. In the meantime I'll look into submitting a MS support case ticket. That way I can talk with someone and do screen sharing.
Any updates on this issue? I am experiencing the same symptoms. The the OP, this also worked prior to the holidays and no longer does. I've even gone as far as installing PS Core 6.2 to test both Windows PS 5.1 and PSC 6. No change in either behavior. Attached are the session logs.
@doug4772 Can you give this a go in the PowerShell Preview extension? It has a ton of fixes in it and it might be fixed in that already.
@TylerLeonhardt That was the last thing I tried since it was already suggested. I was hoping that resolved the issue.
Is this your work machine? If so, I'd like to know what kind of restrictions they put on your device. GPO is possibly a culprit. We sometimes refer folks to try this workaround: https://docs.microsoft.com/en-us/powershell/scripting/components/vscode/using-vscode?view=powershell-6#installing-the-powershell-extension-on-restricted-systems
For some folks, Anti-virus was the culprit.
We can't reproduce this at all, so it's hard to diagnose.
@TylerLeonhardt Yes, this is my work machine (Win10 1809). I can check with one of the admins about GPOs but I don't think anything new was rolled out in the last few weeks. Plus, this impacts a few VSCode users but not all of us. We are all on the latest VSCode and PS Extension. I'm the only one that tried the preview extension.
I did try disabling the Malwarebytes real-time protection, but that didn't seem to impact it either.
The import-module command referenced in the link succeeded, but did not change the VSCode behavior.
Any updates on this issue? I've been forced to use the ISE for PS Scripts that I need an integrated terminal. Blah.
I have also tried the preview extension and same issue. I highly doubt that there was been any GPO changes but it would be helpful if it was known what particular GPO could cause this so that I can check the setting.
Anything that messes with Execution Policy is usually suspicious.
Also, you folks don't run in constrained language mode, right?
PS > $ExecutionContext.SessionState.LanguageMode
Also, the PowerShell extension uses a named pipe for communication... Are there any bizarre file restrictions?
It's really hard to debug this without a solid repo, unfortunately.
My execution policy is unrestricted and I'm not even sure what language mode is so no. I just got off of a sharing session with MS customer support. He recorded my screen and said that he will reach out to the product team. Hopefully that will be helpful to you guys.
I updated Windows 10 from 1809 to 1909 and my issue is resolved. It was an option that was available to me, but likely isn't in all cases. On the bright side, now I can install the Windows Terminal preview as well! Good luck to everyone else.
I am on 1709. I don't control what gets installed on my laptop. I'll have to see how I can get an exception to install a newer Win10 version.
same issue here, I use powershell core 6.2.3, windows 1909, while I managed to solve it by reinstall powershell core from msi. previously I installed it by dotnet global tools hope it helps
same issue here, I use powershell core 6.2.3, windows 1909, while I managed to solve it by reinstall powershell core from msi. previously I installed it by dotnet global tools hope it helps
I installed solely with the MSI from the onset. So, I have no clue what ultimately solved this issue for me.
I don't have powershell core at all. I'm at 5.1.
i just installed 6.2.3 via dotnet global tools. same issue.
@QuyenLy73 the 6.2.3 release of the global tool had a bug in it that made it not work with the extension. That bug is fixed and will be included in 6.2.4 released this week.
@QuyenLy73 can you try installing PowerShell Core 6.2.3 via the MSI or some other method and try again?
Also, I'd appreciate it if those affected could dig around in "Event Viewer" both in the PowerShell events section and Security events section for anything that might be blocking PowerShell in some way.
I can't unfortunately. We don't have full admin privileges to our machines here at my company. I'm trying to find out if there's a way for me to get privileges temporarily to install 6.2.3.
PowerShell Core is xcopy-able. You can download the zip and then add this to your settings:
"powershell.powerShellAdditionalExePaths": [
{
"exePath": "C:\\path\\to\\pwsh.exe",
"versionName": "PowerShell Core download"
}
],
"powershell.powerShellDefaultVersion": "PowerShell Core download",
Sure I'll look but Powershell isn't an issue. I can run powershell scripts just fine. The ISE also works fine. Just an issue with the VS Code extension.
Okay thanks I'll give that a try.
Yeah I know the issue is scoped to VS Code extension but at this time, I don't have enough information to work with. Since I can't repro the issue, I need to explore as many avenues as possible.
How powerful is the machine that you're seeing this issue on?
Core i5-6440HQ 16GB ram
I was just able to install 6.2.3. It was installed at C:\Program Files\PowerShell. Unless I'm in this folder, my PS version shows as 5.1. Not sure if that's expected behavior?
Actually never mind. Looks like 5.1 and Core are installed side by side. I'll add the VS Code setting to point to 6.2.3 and see what happens.
@QuyenLy73 for future reference, you can click on the green PowerShell version number in the bottom right to change what version of PowerShell you want to use. The green version number only shows up if you have a PowerShell script file opened.
So installing 6.2.3 and defaulting to that works. I guess I only need to worry about not using any PS Core specific functionality since none of the servers that I work with use PS Core.
Issue Description
PS session fails to start with these errors. I have taken the cert from Start-EditorServices.ps1 and imported into my local machine's Trusted Publisher's store. I confirmed it's there with an expiration date of 5/2/2020. I have also executed this command but nothing happens.
Import-Module $HOME.vscode\extensions\ms-vscode.powershell*\modules\PowerShellEditorServices\PowerShellEditorServices.psd1
1/14/2020 2:47:41 PM [NORMAL] - Language server startup failed. 1/14/2020 2:47:41 PM [ERROR] - The language service could not be started: 1/14/2020 2:47:41 PM [ERROR] - Timed out waiting for session file to appear.
Attached Logs
Follow the instructions in the README about capturing and sending logs.
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
|Extension|Author|Version| |---|---|---| |All-Autocomplete|Atishay-Jain|0.0.23| |bracket-pair-colorizer-2|CoenraadS|0.0.29| |powershell|ms-vscode|2019.12.0| |python|ms-python|2020.1.58038| |todo-tree|Gruntfuggly|0.0.162|