-
Notifications
You must be signed in to change notification settings - Fork 510
F5 / Ctrl+F5 stops working while Run Active file in Active Terminal with Shift+CTRL+P works #1634
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
F5 / Ctrl+F5 stops working while Run Active file in Active Terminal with Shift+CTRL+P works #1634
Comments
Rather than creating a new issue, and potentially having it be a duplicate of this one, I am adding a comment. I also noticed this, but only after the recent upgrade to 1.10.0. To reproduce... at least on my workstation... Even if making no changes, press F5 again, and it hangs. To workaround, I have had to quit VS Code and open it again. I tested by downgrading to 1.9, and could not reproduce the problem. |
I support @dhoffman98 report. Yesterday, I was using version 1.9 of the module. Today, I have received the updated 1.10.0 version and now, I can't hit F5 to get my code running. I will only run the first time and then hang on. As stated by @PrzemyslawKlys , using the "Run Active File in Active Terminal" solution works as a workaround. |
To downgrade to 1.9.0:
|
Same results as @dhoffman98 and @Tuttu. Was fine with the previous version, but started seeing this issue with version 1.10.0 where I only get one shot to run debugging. I did find that using the trash can to kill the Powershell Integrated Console would cause the extension to realize it terminated and it would ask to restart the console, which would allow another run of debugging. Adding some more info: From EditorServices.log:
Code version:
Extensions:
Editor Services Version:
PSVersionTable:
|
To be honest I had this issue for at least a couple of weeks/months now. It used to be less common, now it's more common but I had this issue with 1.9.0 as well. |
Thanks for the info! Can everyone attach the logs here so we can get a better idea of what's going on? |
1544116548-7ebc2a51-5bb2-4c3d-b5d2-694e610231711544086879684.zip Hrms... indeed I can restart PowerShell session, run F5 once, and the subsequent session doesn't work. |
Thanks! It looks like I can repro this too. Let me investigate |
Do you need more logs @TylerLeonhardt ? |
@Tuttu We can always use more logs, thank you! |
I had issues with 1.10 and also 1.9. I actually went all the way back to 1.8.3 and it works. I'm going to leave it at 1.8.3 until the latest version gets fixed. My vscode is at 1.29.1 |
The same things, with ver. 1.10.0 |
Adding to this as well. This behavior surfaced yesterday w/Ctrl+F5 or F5 w1.10.0. You only get to run a .ps1 once and then I have to do a Reload Window to run another. Painful. |
I actually rebinded my keys. I have removed f6 from Pause and added F6 as run active file in active terminal. This works as workaround for now. |
Thanks for the info, fellas, I was having this issue too and thought it was just me. :) |
I do hope for a permanent fix. It was driving me crazy for the last few months. Now that it happens all the time I hope it's easier to find the root cause. |
Still investigating this issue. Can some one try something for me: uninstall, reload, reinstall, reload the PowerShell extension from the extension marketplace |
I think many of us probably already tried that without success. Same issue exists on macOS as well. |
ah... interesting. Just discovered this only happens when the script completes - not when you hit the stop button and try again. |
I tried it now. Doesn't work. |
I've found the commit with an issue that I think will fix most people's debugging troubles. @PrzemyslawKlys you might be seeing something else in disguise. |
@TylerLeonhardt Nooooo :-( I counted so much this will fix my problem globally. I managed to find another problem (reported) while using workaround for this :/ |
@PrzemyslawKlys thank you for opening issues :) it really does help. |
Ok I have a fix for this: PowerShell/PowerShellEditorServices#807 I'm going to try to do a release today. 1.10.1 |
@TylerLeonhardt for me this works, for a period of time. Now stopped again. I run code as below
I run it a dozen or more times, changing things inside module PSWriteWord. After some rerun, it just stops working. It's not complicated. I run this, comment some code, rerun it again. I've been hitting this error for months now. There's nothing fancy about that code. It's very simple. If this can be looked at I would appreciate it. The fix you did works, but in the end it still fails. |
@PrzemyslawKlys Is it specifically while debugging that module? I haven't used it myself, but I'm guessing that the module is internally calling either a .NET library or a com object. If that's the case, is it possible that in the scenarios that the debugger stops working, there is something blocking the thread? For example, do you see the same issue if you try to debug a script that just contains this line: [System.Threading.Thread]::Sleep([int]::MaxValue) |
This module is working with NET library. I don't use COM-Objects. I've seen this happen multiple times on different occasions but it's hard to track because it's totally random. It can work 50 times and 51 stop working, it can stop working on 1st try, 20, and so on. Except for this case that we had with 1.10 it's not easy to pinpoint. But I've seen this happen on non-net modules (but to be honest it very well could be related to NET - since I could be using some calls to .NET not even thinking about it). It can be as simple as:
And I do use it from time to time. Checking for IsNullOrWhiteSpace and so on. But be aware that I have changed a key binding I use F5 which for me is without debugging and I still hit this. |
@SeeminglyScience is there a way I can help debug this? I just had this situation but in a bit different scenario. By default, I don't use breakpoints. But now I was testing something and I did CTRL+F5 (as per my setup Start Debugging) and it shows something like this:
And if you try to press F5 it doesn't do anything. Maybe it's going into that state in Start Without Debugging for some reason? |
@PrzemyslawKlys The majority of .NET APIs (including That said, if you'd like to test if it is a .NET API that is blocking, you can run this script from standalone PowerShell console: $psesProcesses = Get-PSHostProcessInfo |
Where-Object MainWindowTitle -EQ '' |
Where-Object ProcessName -In powershell, pwsh
if (-not $psesProcesses) {
throw 'Cannot find any PSES processes.'
}
foreach ($psesProcess in $psesProcesses) {
if ($psesProcess.ProcessId -eq $PID) {
continue
}
$connectionInfo = [System.Management.Automation.Runspaces.NamedPipeConnectionInfo]::new(
$psesProcess.ProcessId)
$rs = $null
$ps = $null
try {
$rs = [runspacefactory]::CreateRunspace($host, $connectionInfo)
$rs.Open()
$ps = [powershell]::Create()
$ps.Runspace = $rs
$null = $ps.AddScript{
$rs = Get-Runspace 2
$pipeline = $rs.GetType().
GetMethod(
'GetCurrentlyRunningPipeline',
[System.Reflection.BindingFlags]'Instance, NonPublic').
Invoke($rs, @())
return $pipeline.Commands |
Select-Object -First 1 -ExpandProperty CommandText
}
return [PSCustomObject]@{
Id = $psesProcess.ProcessId
CurrentlyRunningCommand = $ps.Invoke()
}
} finally {
if ($null -ne $ps) {
$ps.Dispose()
}
if ($null -ne $rs) {
$rs.Dispose()
}
}
} That will tell you what the currently executing command is (if any) for each instance of the language server. |
I assume I should use this when I hit a problem? And possibly report back with information from it? |
@PrzemyslawKlys if If you run into the issue and |
@SeeminglyScience Ok, will update when I hit the problem again. Thank you. |
I'm going to reopen this issue since it's where most of the information and discussion is and the problem, while better, still exists. |
I guess it's PSES :-(
|
@PrzemyslawKlys Can you do |
Next time ;-) Didn't expect you to respond so fast ;) |
Just to make sure I understand this. I should run this command with a path to file that has the code you gave me? I've created (c:\Support\GitHub\PSWriteHTML\Ignore\PSES-ErrorException.ps1) and it holds the code from above so next time I will run this code and then follow it up with the command you just gave me. Right? |
Yeah, basically I want to see the expanded value of |
Doesn't seem like much help. I do have logs if you need them |
Yeah I need the expanded value. Like this: $originalObject = & c:\Support\GitHub\PSWriteHTML\Ignore\PSES-ErrorException.ps1
$originalObject.CurrentlyRunningCommand |
I was running this:
I tried executing it multiple times 1 by 1 - it worked for like 2 tries and 3rd failed. I quickly checked the output of your command;
Hope this helps. One thing I noticed is that it's more prone to happen after I leave VSCode open and up and running, doing nothing. However not always. |
Run at it again in different module:
So same output. |
@PrzemyslawKlys Wait are you running that in the integrated console itself? That script was intended to run from a separate process that has entered the PSIC process via If you're able to run that in the integrated console, then it's not hung in the same sense that I was expecting. It sounds like VSCode is either not sending the |
And the output I pasted is what you get when you run the script with F6 you gave me after F5 stops working. |
@PrzemyslawKlys are you still seeing this? |
Possibly this was the same as #2488? |
Issue Description
Since some time now I often end up with F5, CTRL+F5 being unresponsive. It can happen right after VSCode start, after 1st run, after multiple runs. Totally random. In this case, I was able to run the code once, and subsequent F5 wouldn't work. I can execute a script with SHIFT+CTRL+P and choosing
Run active file in active terminal
although I am not sure it's the same thing.Expected Behaviour
Shouldn't bug out.
Actual Behaviour
Attached Logs
Don't have logs for now, but I can try to get it. From earlier look at logs simply nothing happens when I press F5 or CTRL+F5. It's like those commands get detached or something.
The text was updated successfully, but these errors were encountered: