Closed PrzemyslawKlys closed 4 years ago
Honestly, at this point, the problem has to be deep in PowerShell Editor Services's handling of the PowerShell runspace.
I've tried to avoid diving into that as it will take a lot of time and will involve coordinating with @daxian-dbw on PSReadLine but unfortunately that's where we're at.
I'll need more people to bother @SteveL-MSFT here and on Twitter to treat this as a priority.
@TylerLeonhardt I experienced this once yesterday. I commented here as #2522 is now closed.
I also experienced the same with PowerShell extension 2020.3.0 with PowerShell 7.0.
Basically, intellisense stops working after a while. Then, if you run a command in the integrated console, it doesn’t get executed, but instead the command prompt will be displayed immediately, and after that things starts to work again. But the same will happen after a while again.
Maybe related: https://github.com/PowerShell/vscode-powershell/issues/2364
@daxian-dbw the Preview extention has a bunch of work in it to prevent this... But this issue claims it isn't completely fixed.
I'm seeing a similar issue and I never started a debug session. I'm on preview 2020.4.2 (VSCode 1.44.2) and here's my log zip. I'm not seeing anything obvious here. BTW it is cool that cancel requests indicate the message number they're cancelling. I just wish the original LSP msgs displayed their request number. EditorServices.zip
OK, my PSIC is completely unresponsive which would explain why completions aren't working. :-) Now, why is PSIC wedged?
Weirdly enough when I deleted PS extension and reinstalled it everything seemed snappier. But it came back to being slow after a while. I restart PS Extension about 3 times per hour now.
But this issue claims it isn't completely fixed.
I still find myself having to kill the extension multiple times every day. I think things have improved for sure, but it's still basically reliable. Ironically, I tend to keep my modules a single huge files in part because the extension is unreliable, which in turn seems to make the extension less reliable. I get that working in a 10K LoC module file is not the common case for a PS user, but I don't think it's completely crazy/unreasonable.
I use multifile, multifolder modules. But its random. I can open fresh session and even on very small codebase it chuckles on Get-content parameters.
Issue seems worse in v2020.4.0... stops working after 3-5 minutes.
@bspach when completions stop working, is your PS integrated console also unresponsive?
Integrated console works fine; Ctrl+Space immediately pops up all available cmdlet arguments in PSIC.
Edit: I let Code sit idle for about 15 minutes (afer loading a PS script into the editor) and now intellisense is working quickly/responsively, only a 1-3 second pause before the available options pop up when hitting Ctrl+Space or typing a "-".
Edit 2: Works inconsistently... stopped working again after a few minutes.
I have the same thing. Also F8 will stop working but PSIC is still responding when used directly
I've updated to newest preview and the issue is still there. It's pretty much unstable. Formatting stops working, so does IntelliSense. This issue kills so much productivity.
@PrzemyslawKlys do you think it's gotten worse or is about the same?
@TylerLeonhardt Between last 2 versions, same. But i am in situation where I have to restart 5 times in an hour to get formatting/intellisense.
Just so you know, I am working on this, though not directly writing code just yet.
So things are happening... I've not given up on this.
FWIW this issue seems to be massively more annoying on Mac OS. I'm running Catalina and seeing this issue quite a lot, at least every 5-10 minutes which is pretty annoying. Restarting doesn't take long and I tend to keep the PSIC in the background (I have the extension settings configured to keep it hidden) so it doesn't cause too many issues apart from hanging on formating / suggestions freezing / tab completion failing. Annoying, but livable since restarting it doesn't take too long anyway.
But a fix would still be very appreciated. 😊
It's not more annoying on Mac OS. It's the same on Windows. It's random but it starts failing pretty quick. Your Mac OS doesn't have more problems than my Windows! :-D
I'm happy to collect data if it helps. This issue has become completely debilitating for me. I might be able to get 30 minutes after a terminal restart, but often it locks up within five minutes or so. I was seeing the issue more sporadically a few weeks ago; it's been much worse since I installed Preview at that time.
Piling on, with hopefully information that helps: I have had this issue (autocomplete stops working after some time/usage) for weeks on two Win10 1909 machines.
It happens whether I have WPS or PSC selected for either my default PS Session or for the PSIC, and whether I use the PSIC or not. I can sometimes restore it by killing the PSIC -- I don't have to have restarted the PSIC for the autocomplete to be restored, just ending the current PSIC session will do it.
I haven't done the full uninstall-reinstall, and it's been a while since I was using the PS Preview extension since I originally thought it was the problem and the GA PS extension had been less likely to exhibit this problem, but that's not true now.
I'm also happy to collect data.
Thanks for the info! Can you all also attach the logs here so we can get a better idea of what's going on?
Thanks for the info! Can you all also attach the logs here so we can get a better idea of what's going on?
I can’t attach them for public viewing, but I did email them per the documentation.
When intellisense hangs for me, I see this error repeated in PS Editor Service Output. It looks like it could be related to this issue and recent fix in the OmniSharp lib. Is there a deep dependency to this?
https://github.com/OmniSharp/omnisharp-roslyn/pull/1791
The same error is seen in emacs
as well https://github.com/emacs-lsp/lsp-mode/issues/1125
[Error - 5:51:00 PM] OmniSharp.Extensions.LanguageServer.Server.LspRequestRouter: Failed to handle notification textDocument/signatureHelp - System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.PowerShell.EditorServices.Services.PowerShellContext.CommandHelpers.GetCommandInfoAsync(String commandName, PowerShellContextService powerShellContext) in D:\a\1\s\src\PowerShellEditorServices\Services\PowerShellContext\Utilities\CommandHelpers.cs:line 99
at Microsoft.PowerShell.EditorServices.Services.SymbolsService.FindParameterSetsInFileAsync(ScriptFile file, Int32 lineNumber, Int32 columnNumber, PowerShellContextService powerShellContext) in D:\a\1\s\src\PowerShellEditorServices\Services\Symbols\SymbolsService.cs:line 357
at Microsoft.PowerShell.EditorServices.Handlers.SignatureHelpHandler.Handle(SignatureHelpParams request, CancellationToken cancellationToken) in D:\a\1\s\src\PowerShellEditorServices\Services\TextDocument\Handlers\SignatureHelpHandler.cs:line 61
at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(TDescriptor descriptor, Request request, CancellationToken token)
I'm having the same issue and I have tried everything I can think of. I have uninstalled and reinstalled VS Code. I switched to the PowerShell Preview extension. I've turned off almost every setting someone recommended somewhere to fix this problem. I have removed every extension I used to use. I have the same issue on multiple computers. I know other people having the same problem. I'm almost ready to abandon VS Code due to this issue.
Sometimes (rarely) I can use it all day long and it's fine. Other times it fails within a few minutes of launching. The problem seems to be getting much worse. It used to be something that happened once a month. Now it might happen every 5 minutes. When things go wrong, I have the following issues that generally all happen at the same time, but not always. For example, sometimes F8 stops working but I can still expand/collapse code regions. But typically that breaks at the same time as everything else.
The only fix is to restart either the terminal or restart the entire application.
I have reproduced the issue with the diagnostic logging enabled. I also probably shouldn't post the logs publicly from my work computer, but I will email them in.
@GuruGarrett - from what @TylerLeonhardt told me in another issue regarding F8
The debug messages get sent over a different channel.
If that's (F5) working just fine, that means:
debug channel is working the PowerShell instance we use for everything is working BUT the channel we use for language features (IntelliSense, codelens, folding, F8, etc) is not working... That channel is provided by the Omnisharp library... And the latest version (allegedly) fixed channel issues.
Unfortunately, the fix that was dropped didn't fix it. So in short F5 works, anything you type in a console will work, but anything related to a channel for language features will not work. Unfortunately, I can feel your pain as I restart the console every 5 minutes. I was even thinking to have timer for language features and restart automatically, but this is more painful for o365 sessions.
@GuruGarrett - from what @TylerLeonhardt told me in another issue regarding F8
The debug messages get sent over a different channel. If that's (F5) working just fine, that means: debug channel is working the PowerShell instance we use for everything is working BUT the channel we use for language features (IntelliSense, codelens, folding, F8, etc) is not working... That channel is provided by the Omnisharp library... And the latest version (allegedly) fixed channel issues.
Unfortunately, the fix that was dropped didn't fix it. So in short F5 works, anything you type in a console will work, but anything related to a channel for language features will not work. Unfortunately, I can feel your pain as I restart the console every 5 minutes. I was even thinking to have timer for language features and restart automatically, but this is more painful for o365 sessions.
This has caused me so much frustration and repeated work that I am seriously considering going back to Powershell ISE. It will make me very sad, but at least I won't have to relaunch it 100 times a day. And yes 95% of my work is in Office 365 so it is especially irritating having to reconnect to the services each time. I have been holding out hoping any day now this issue will be fixed, but instead it keeps getting worse.
I wish I could do more to help solve this, because I LOVE using VS Code for PowerShell when it works properly. It almost makes me want to learn other languages so I could actually contribute. But honestly I'm not quite that motivated yet.
I am not 100% sure this is the same issue but I am also not able to use the splatting feature anymore. If I do Ctrl+Shift+P and then type addi to bring up the option for "Show additional commands for PowerShell modules", when I select it, I can't then type splat to convert an existing command parameters to a hash table like I used to. Instead, I get the statement "No extension commands have been loaded into the current session". I am also experiencing the intellisense stopping though that seems to be working a little better for me with the Preview version of the PS Extension. I am working on a pretty new machine that I haven't done a lot of PS development on since I built it last month. I have VSCode and the PS extension (not the preview on this one) and when I enable Diagnostics and do the same thing as above, I get "Command 'PowerShell: Show Additional Commands from PowerShell Modules' resulted in an error (Running the contributed command: 'PowerShell.ShowAdditionalCommands' failed.)
1.45.1 5763d909d5f12fe19f215cbfdd29a91c0fa9208a x64
ms-vscode.powershell@2020.4.0
Major Minor Build Revision
2 1 0 0
Name Value
PSVersion 5.1.18362.752 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.18362.752 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
Begin debug logs: StartEditorServices.log vscode-powershell.log EditorServices.log
If I can provide any further information, please let me know. I do most of my PS development either on my office computer or laptop. This is my home office computer that was a fresh build last month and you can see that I haven't even added all of my normal extensions since all I have is PS extension. This machine is exhibiting the same problem my other two machine are doing. I actually used splatting quite a bit a few years ago but I haven't done much PS Development for the last year and just getting back into it. A few years ago, I had to add the seeminglyscience module in and put it in my profile to get this functionality. It appears that module is integrated into VS Code now but it doesn't seem to be working. If this is a separate issue from this, I am happy to spin off a new issue.
Thanks Charles
@cjpalmer It is not - at least not directly. It's related to EditorServicesCommandSuite and I've opened an issue about it here https://github.com/SeeminglyScience/EditorServicesCommandSuite/issues/57
Each new preview breaks EditorServicesCommandSuite tho :-)
Thank you PrzemyslawKlys. I will follow it there. But I want to bring up this point, all of my testing was done on my system that doesn't have the preview installed. I have the 2020.4.0 version on this machine. I am seeing this problem on all three machines.
So since I read that F5/debug seems unaffected by this issue, I decided to try it last night when I had the problem again. What's weird is starting debug and then stopping it fixed the problem. After stopping debug, F8 started working again, IntelliSense worked, code folding worked, everything started working again. Weird, but it might be a potential workaround/fix without having to kill and restart the terminal.
Problem happened again, this time the F5 trick didn't fix it though. My logs have been emailed.
Folks on this thread, if you are on Windows with the latest stable PowerShell VS extension and run into the "IntelliSense not working after a while" issue without having the debugger involved, can you please create a dump file of the PowerShell Integrated Console process and share with us (maybe via a OneDrive share link)?
You will need to save the process id of PSIC initially, and when the issue happens, create a dump file using Task Manager. Or use dotnet-dump (please select --type Heap
). Thanks!
@daxian-dbw please provide instructions on how to do so. We're just noobs using PowerShell :-)
Haven't done this in a while, but this seems to be it:
$pid
in the PSIC which will be the process ID, make note of it.pwsh.exe
process with the PID you noted down in step 2.Create Dump File
Thanks, I will try to share the file the next time it acts up. But usually when I try to reproduce, it works fine for longer than normal. 🙂
Just reread the request - I have the same issue using both the stable/regular PowerShell extension and the preview version. I'm currently running preview, but I will switch back to stable so I can gather the dump file. I'm willing to do whatever I can because this issue is driving me crazy and is starting to affect more and more of my coworkers (or they are starting to notice it more).
IntelliSense just died on me. I have not used the debugger since launching VS Code. As is typical, F8 stopped functioning at the same time that IntelliSense died.
Here's the dump you requested. The link is set to expire on Friday, but I will probably remove the sharing before then if I get confirmation that whoever needs this has saved it.
(redacted)
Funny, a coworker just called me for help and was experiencing this same issue. I'll share that dump file too as soon as I get a copy.
@GuruGarrett Thanks for the quick help! I appreciate it. I have pulled down the dump, and will look into it later today or tomorrow.
When you folks see Intellisense/F8 stop working, can you confirm if Folding and CodeLens still work?
Just add this to your script:
function foo() {
}
and let me know if you see the little CodeLens show up and fold.
@GuruGarrett I inspected the dump, but don't see anything suspicious :(
The pipeline thread in the dump is blocked on a WaitAll
call within PSReadLine which is expected and should be unblocked by PSES when there is an intellisense request coming in.
After it's unblocked, the intellisense request will be evaluated on the pipeline thread.
The fact that intellisense didn't work suggests two possible reasons:
WaitAll
call.Chatted with @TylerLeonhardt offline, and he is inclined to believe it's Omnisharp's fault. I will be using a private build version of PSES during the following days and hopefully am able to reproduce this issue so that I can debug the live code.
Folding normally stops working at the same time as IntelliSense and F8 for me.
I previously disabled CodeLens in an effort to eliminate this problem, some people seemed to think it was the cause. I can enable it again and let you know.
Here's another dump for you from another system.
(redacted)
I just had F8 stop working on me again.
CodeLens and IntelliSense stopped working at the same time.
Folding continues to work (not typical in my experience).
And a fresh instance just died on me again in less than 10 minutes of use. F8 was the first thing I noticed not working, because that's what I use the most in my daily work. In this case folding, IntelliSense, and CodeLens all stopped along with it.
Would you like more dump files every time this happens?
@GuruGarrett I inspected the new dump you shared at https://github.com/PowerShell/vscode-powershell/issues/2627#issuecomment-631837229, and it looks the same as the previous dump with 3 additional idle threads from the script analyzer, nothing suspicious found.
@TylerLeonhardt mentioned in our offline chat that:
Folding and CodeLens - two operations that don't execute any PowerShell If those are also blocked, then I feel more confident about it being Omnisharp
Based on your description:
F8 was the first thing I noticed not working, because that's what I use the most in my daily work. In this case folding, IntelliSense, and CodeLens all stopped along with it.
It becomes more likely that Omnisharp is the culprit.
@daxian-dbw is there anything I can do to help confirm that or work towards a fix? Any possible workarounds?
@GuruGarrett Not at this moment, but thank you! @TylerLeonhardt identified something abnormal in the logs shared here, and has been having a conversation with the Ominisharp folks.
2020-04-11 09:58:12.346 +02:00 [DBG] Starting: Routing Request (8) textDocument/codeLens 2020-04-11 09:58:12.346 +02:00 [VRB] Converting params for Request (8) textDocument/codeLens to OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeLensParams
these 2 logs happen right before the Handle function is run in our code. if you look at any of the EditorServices logs in that thread... what you'll see is that those 2 logs ^ stop happening
Ok folks. I have an unsupported dev build for you all to try. This has ton of changes from the Omnisharp lib that we believe is causing the issue.
Here's what you need to do.
Download the Windows (even if you're on non-Windows) VSIX from here (if you don't see it in the drop down, then download vscode-powershell
):
https://dev.azure.com/powershell/vscode-powershell/_build/results?buildId=53577&view=artifacts&type=publishedArtifacts
Then run this on it:
code --install-extension C:\path\to\powershell-preview-2020.5.1-CI.53577-Windows.vsix
or code-insiders
if you use vscode insiders.
That'll install it. Test it out. Use it like you normally do... let me know how it goes.
Issue Description
I am experiencing a problem with...IntelliSense not working after a while.
I am aware of a recent fix and other closed issues:
But I still experience issues, far less but still.
Attached Logs
1586591887-8aec1d54-a22f-4e9a-9d5a-026cf95b0ba11586539769772.zip
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| |---|---|---| |autoit|Damien|1.0.4| |beautify|HookyQR|1.5.0| |bracket-pair-colorizer-2|CoenraadS|0.0.29| |code-settings-sync|Shan|3.4.3| |codesnap|adpyke|1.0.27| |excel-to-markdown-table|csholmq|1.2.2| |gistfs|vsls-contrib|0.0.65| |github-linker|gimenete|0.2.3| |gitlens|eamodio|10.2.1| |html-preview-vscode|george-alisson|0.2.5| |markdown-all-in-one|yzhang|2.8.0| |markdown-preview-enhanced|shd101wyy|0.5.2| |markdown-shortcuts|mdickin|0.12.0| |material-icon-theme|PKief|4.0.1| |pdf|tomoki1207|0.5.1| |powershell-preview|ms-vscode|2020.4.1| |project-manager|alefragnani|10.11.0| |reg|ionutvmi|1.0.1| |theme-monokai-pro-vscode|monokai|1.1.15| |vscode-html-css|ecmel|0.2.3| |vscode-markdownlint|DavidAnson|0.34.0| |vscode-pull-request-github|GitHub|0.15.0| |vscode-toggle-quotes|BriteSnow|0.3.2| |vscode-versionlens|pflannery|0.25.0| |vscode-wakatime|WakaTime|4.0.0| |vscode-yaml|redhat|0.7.2| |xml|DotJoshJohnson|2.5.0|