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.
Shouldn't bug out.

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.
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...
After upgrade to 1.10.0,
Open a script.
Press F5.
Script executes and upon completion, exits debugging mode.
Even if making no changes, press F5 again, and it hangs.
When it hangs, if on the debug view, at the top left of the screen, under the Configuration selector, a tiny blue bar runs across that part of the screen, and never stops. (Under normal circumstances, the bar is still there, but only briefly.)
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.
Upgrade again to 1.10, and the problem happens again, every time.
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:
2018-12-06 10:48:12.832 [WARNING] tid:20 in 'DispatchMessage' C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageDispatcher.cs: line 147
MessageDispatcher: No handler registered for Event type '$/setTraceNotification'
Code version:
1.29.1
bc24f98b5f70467bc689abf41cc5550ca637088e
x64
Extensions:
bierner.[email protected]
CoenraadS.[email protected]
eamodio.[email protected]
ms-python.[email protected]
ms-vscode.[email protected]
PeterJausovec.[email protected]
Shan.[email protected]
Editor Services Version:
Major Minor Build Revision
----- ----- ----- --------
1 10 0 0
PSVersionTable:
Name Value
---- -----
PSVersion 5.1.16299.785
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.785
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
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
F5 work only one time.
Only with restart current session I can debug again.
The usual Christmas gift from Microsoft.....
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: https://github.com/PowerShell/PowerShellEditorServices/pull/807
I'm going to try to do a release today. 1.10.1
Let's cross our finger :) Looking forward to the release.
On Fri, Dec 7, 2018 at 12:23 PM Tyler James Leonhardt <
[email protected]> wrote:
Ok I have a fix for this: PowerShell/PowerShellEditorServices#807
https://github.com/PowerShell/PowerShellEditorServices/pull/807I'm going to try to do a release today. 1.10.1
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/PowerShell/vscode-powershell/issues/1634#issuecomment-445320868,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AILwh2ilC2doTFZf2NjqIS8N9ncrQPvYks5u2rIVgaJpZM4ZGGJz
.
--
Very truly yours,
Randy L. Grolemund, Jr.
1.10.1 was published. Please give it a try, everyone
@TylerLeonhardt I just updated my PowerShell extensions to 1.10.1 and it worked for me! Great job!
@TylerLeonhardt for me this works, for a period of time. Now stopped again. I run code as below
Import-Module pswriteword -Force
$FilePath = "$Env:USERPROFILE\Desktop\test111.docx"
$WordDocument = New-WordDocument $FilePath
$Table1 = new-WordTable -WordDocument $WordDocument -NrRows 3 -NrColumns 3
Set-WordTable -Table $Table1 -Design MediumGrid3Accent1 -Supress $true
Add-WordTableCellValue -Table $Table1 -Row 0 -Column 0 -Value "test1" -Supress $true
#Add-WordTableCellValue -Table $Table1 -Row 0 -Column 1 -Value "test2" -Supress $true
#Add-WordTableCellValue -Table $Table1 -Row 0 -Column 1 -Value "test3" -Supress $true
#Add-WordTableCellValue -Table $Table1 -Row 0 -Column 2 -Value "test4" -Supress $true
$Table1.Rows[0].Cells[0]
Set-WordTableRowMergeCells -Table $Table1 -RowNr 0 -ColumnNrStart 0 -ColumnNrEnd 2 -Verbose -Supress $True -TextMerge
$Table1.Rows[0].Cells[0]
Save-WordDocument -WordDocument $WordDocument -OpenDocument -Supress $true
#Set-WordTableRowMergeCells line 101 work with:
#for ($paragraph = 1; $paragraph -lt $Table.Rows[$RowNr].Cells[$ColumnNrStart].Paragraphs.Count; $paragraph++) {
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:
[datetime]::Now()
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:
Hit Line breakpoint on 'C:\Support\GitHub\PSWinReporting\Examples\RunMe-SearchEvents.ps1:5'
[DBG]: PS C:\Support\GitHub\PSWinReporting\Examples> c:\Support\GitHub\PSWinReporting\Private\Events\Get-EventsTranslation.ps1
[DBG]: PS C:\Support\GitHub\PSWinReporting\Examples>
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 [datetime]::Now and [string]::IsNullOrEmpty()) won't (noticeably) block, so it's probably a threading related issue on our end. I've ran into it a few times myself, but there's a few different causes. They are really tricky to debug without running a full debug build day to day and attaching the examine the call stack. I've fixed a few as part of the PSRL changes in 2.0, but there's definitely a few left.
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 CurrentlyRunningCommand is not blank, then there is a high chance something in your script is blocking. If it's part of an actual debug session it could still be us, but if it's "run without debugging" then it's almost definitely something blocking in the script. If that's the case then we can't unblock it, that's a limitation (or more likely a design choice) of the CLR (.NET runtime).
If you run into the issue and CurrentlyRunningCommand is blank, then it's almost definitely PSES.
@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 :-(
PS C:\Support\GitHub\PSWriteHTML> c:\Support\GitHub\PSWriteHTML\Ignore\PSES-ErrorException.ps1
Id CurrentlyRunningCommand
-- -----------------------
26268 {...
@PrzemyslawKlys Can you do (& c:\Support\GitHub\PSWriteHTML\Ignore\PSES-ErrorException.ps1).CurrentlyRunningCommand? Need to see what's running and it got cut off by formatting
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 CurrentlyRunningCommand.
PS C:\Support\GitHub\PSWriteHTML> c:\Support\GitHub\PSWriteHTML\Ignore\PSES-ErrorException.ps1
Id CurrentlyRunningCommand
-- -----------------------
26268 {}
PS C:\Support\GitHub\PSWriteHTML> c:\Support\GitHub\PSWriteHTML\Ignore\PSES-ErrorException.ps1
Id CurrentlyRunningCommand
-- -----------------------
15996 {...
PS C:\Support\GitHub\PSWriteHTML> c:\Support\GitHub\PSWriteHTML\Ignore\PSES-ErrorException.ps1
Id CurrentlyRunningCommand
-- -----------------------
26424 {}
PS C:\Support\GitHub\PSWriteHTML> c:\Support\GitHub\PSWriteHTML\Ignore\PSES-ErrorException.ps1
Id CurrentlyRunningCommand
-- -----------------------
26268 {}
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:
function Add-Image {
param(
[string] $Source,
[Uri] $UrlLink = '',
[string] $AlternativeText = '',
[string] $Class = 'Logo',
[nullable[int]] $Width,
[nullable[int]] $Height
)
$HTML = Get-Content "$PSScriptRoot\..\Resources\HTML\Image.html"
if ($UrlLink -eq '') {
$HTML = $HTML.Replace('target="_blank"', '')
}
$HTML = $HTML -Replace 'DefaultHref', $UrlLink `
-Replace 'DefaultSource', $Source `
-Replace 'DefaultAlternativeText', $AlternativeText `
-Replace 'DefaultClass', $Class `
-Replace 'DefaultWidth', $Width `
-Replace 'DefaultHeight', $Height
return $HTML
}
Add-Image
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;
PS C:\Support\GitHub\PSWriteHTML> c:\Support\GitHub\PSWriteHTML\Ignore\PSES-ErrorCheck.ps1
$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
PS C:\Support\GitHub\PSWriteHTML>
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:
PS C:\Support\GitHub\PSSharedGoods\Ignore> c:\Support\GitHub\PSWriteHTML\Ignore\PSES-ErrorCheck.ps1
$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
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 Enter-PSHostProcess.
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 launch request anymore or PSES just isn't listening.
I'm using the F6 command (I mapped it myself) to execute a file 'Run active file in Active Terminal`

And that works fine when F5/CTRL+F5 is broken. So I can type commands in the console manually I can run file by using as above but I can no longer run scripts properly.
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 https://github.com/PowerShell/vscode-powershell/issues/2488?
Most helpful comment
@TylerLeonhardt I just updated my PowerShell extensions to 1.10.1 and it worked for me! Great job!