Skip to content

Temporary integrated consoles stuck waiting for key press #3950

Closed
PowerShell/PowerShellEditorServices
#1791

Description

@ohaak2

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

With vscode version 1.66.2 and PowerShell extension v2022.5.0 I'm suddenly unable to start any PowerShell session, if the powershell.debugging.createTemporaryIntegratedConsole parameter is set to 'true'.

PowerShell session isn't even started in run mode. It's just hanging somewhere before actually processing any custom code. No code will be executed, no breakpoint reached. I can reproduce the isse even with a single file containing 'hello world' output.

Switching this setting to 'false' and everything is fine.

PowerShell Version

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.3
PSEdition                      Core
GitCommitId                    7.2.3
OS                             Microsoft Windows 10.0.22000
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

PS > code --version

1.66.2
dfd34e8260c270da74b5c2d86d61aee4b6d56977
x64

Extension Version

PS > code --list-extensions --show-versions | Select-String powershell

ms-vscode.powershell@2022.5.0

Steps to Reproduce

  • Open PowerShell file in vscode.
  • set powershell.debugging.createTemporaryIntegratedConsole configuration parameter to 'true'
  • try to start run or debug session.

Visuals

No response

Logs

DEBUG: Logging started
DEBUG: Beginning EndProcessing block
VERBOSE: Removing PSReadLine
DEBUG: Creating host configuration
DEBUG: Determining REPL kind
DEBUG: REPL configured as PSReadLine
DEBUG: Configuring LSP transport
DEBUG: No LSP transport: PSES is debug only
DEBUG: Configuring debug transport
DEBUG: Session file writer created
VERBOSE: Adding AssemblyResolve event handler for new AssemblyLoadContext dependency loading
VERBOSE: Loading EditorServices
VERBOSE: PID: 9424
VERBOSE:
== Build Details ==

  • Editor Services version: 3.3.4
  • Build origin: Release
  • Build commit: 691b941e113d7aa1e3876b1e1da301098f8df392
  • Build time: 03.05.2022 00:00:00

VERBOSE:
== Host Startup Configuration Details ==

  • Host name: Visual Studio Code Host

  • Host version: 2022.5.0

  • Host profile ID: Microsoft.VSCode

  • PowerShell host type: System.Management.Automation.Internal.Host.InternalHost

  • REPL setting: PSReadLine

  • Session details path: c:\Users\rueha.vscode\extensions\ms-vscode.powershell-2022.5.0\sessions\PSES-VSCode-6644-Debug

  • Bundled modules path: c:\Users\rueha.vscode\extensions\ms-vscode.powershell-2022.5.0\modules

  • Additional modules: PowerShellEditorServices.VSCode

  • Feature flags:

  • Log path: c:\Users\rueha.vscode\extensions\ms-vscode.powershell-2022.5.0\logs\1651659916-33522e08-f534-442f-90f9-4f15d444b3e31651659351331\DebugSession-4.log

  • Minimum log level: Diagnostic

  • Profile paths:

    • AllUsersAllHosts: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.2.3.0_x64__8wekyb3d8bbwe\profile.ps1
    • AllUsersCurrentHost: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.2.3.0_x64__8wekyb3d8bbwe\Microsoft.VSCode_profile.ps1
    • CurrentUserAllHosts: C:\Users\rueha\Documents\PowerShell\profile.ps1
    • CurrentUserCurrentHost: C:\Users\rueha\Documents\PowerShell\Microsoft.VSCode_profile.ps1

DEBUG: Assembly resolve event fired for System.Text.Encoding.CodePages.resources, Version=6.0.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a
DEBUG: Assembly resolve event fired for System.Text.Encoding.CodePages.resources, Version=6.0.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: Microsoft.PowerShell.Commands.Diagnostics, Version=7.2.3.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: Microsoft.WSMan.Management, Version=7.2.3.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: Microsoft.WSMan.Runtime, Version=7.2.3.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.Security.resources, Version=7.2.3.500, Culture=de-DE, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.Security.resources, Version=7.2.3.500, Culture=de, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for Microsoft.WSMan.Management.resources, Version=7.2.3.500, Culture=de-DE, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for Microsoft.WSMan.Management.resources, Version=7.2.3.500, Culture=de, PublicKeyToken=31bf3856ad364e35
VERBOSE:
== Console Details ==

  • Console input encoding: Western European (DOS)
  • Console output encoding: Western European (DOS)
  • PowerShell output encoding: Unicode (UTF-8)

VERBOSE:
== PowerShell Details ==

  • PowerShell version: 7.2.3
  • Language mode: FullLanguage

VERBOSE:
== Environment Details ==

  • OS description: Microsoft Windows 10.0.22000
  • OS architecture: X64
  • Process bitness: 64

VERBOSE: Updated PSModulePath to: 'C:\Users\rueha\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\windowsapps\microsoft.powershell_7.2.3.0_x64__8wekyb3d8bbwe\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;c:\Users\rueha.vscode\extensions\ms-vscode.powershell-2022.5.0\modules'
DEBUG: Validating configuration
VERBOSE: Loading PowerShell Editor Services
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Version=3.3.4.0, Culture=neutral, PublicKeyToken=null
VERBOSE: Loading PSES DLL using new assembly load context
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.PowerShell.EditorServices, Version=3.3.4.0, Culture=neutral, PublicKeyToken=null
VERBOSE: Starting EditorServices
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.Extensions.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Serilog.Sinks.Async, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Serilog.Extensions.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Serilog.Sinks.File, Version=5.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.Extensions.Options, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
DEBUG: Creating/running editor services
DEBUG: Creating startup info object
DEBUG: Running temp debug session
DEBUG: Creating named pipe
DEBUG: Waiting for named pipe connection
DEBUG: Writing session file
DEBUG: Writing session started
VERBOSE: Session file written to c:\Users\rueha.vscode\extensions\ms-vscode.powershell-2022.5.0\sessions\PSES-VSCode-6644-Debug with content:
{"status":"started","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\.\pipe\PSES_gwa1rshq.nux"}
DEBUG: Waiting on PSES run/shutdown
DEBUG: Named pipe connected
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System.Threading.Tasks.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: OmniSharp.Extensions.LanguageProtocol, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: OmniSharp.Extensions.JsonRpc, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System.Buffers, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
VERBOSE: Debug server created
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: OmniSharp.Extensions.DebugAdapter.Server, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: MediatR, Version=8.0.0.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: OmniSharp.Extensions.DebugAdapter, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: OmniSharp.Extensions.DebugAdapter.Shared, Version=0.19.0.0, Culture=neutral, PublicKeyToken=6d868dff454e6022
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.Extensions.Configuration.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: System.Reactive, Version=4.4.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Nerdbank.Streams, Version=2.6.0.0, Culture=neutral, PublicKeyToken=cac503e1823ce71c
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: System.IO.Pipelines, Version=4.0.2.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.VisualStudio.Validation, Version=15.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.VisualStudio.Threading, Version=16.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System.Diagnostics.StackTrace, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
DEBUG: Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.Extensions.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System.Threading.Channels, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: Microsoft.PowerShell.PSReadLine2, Version=2.2.5.0, Culture=neutral, PublicKeyToken=null
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.PSReadLine.Polyfiller, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: Microsoft.PowerShell.PSReadLine.Polyfiller, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
DEBUG: Assembly resolve event fired for System.Management.Automation.resources, Version=7.2.3.500, Culture=de-DE, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for System.Management.Automation.resources, Version=7.2.3.500, Culture=de, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for System.Management.Automation.resources, Version=7.2.3.500, Culture=de-DE, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for System.Management.Automation.resources, Version=7.2.3.500, Culture=de, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.Commands.Utility.resources, Version=7.2.3.500, Culture=de-DE, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.Commands.Utility.resources, Version=7.2.3.500, Culture=de, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for System.Management.Automation.resources, Version=7.2.3.500, Culture=de-DE, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for System.Management.Automation.resources, Version=7.2.3.500, Culture=de, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.Commands.Utility.resources, Version=7.2.3.500, Culture=de-DE, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.Commands.Utility.resources, Version=7.2.3.500, Culture=de, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
VERBOSE: Loading PSES DLL using new assembly load context
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
VERBOSE: Loading PSES DLL using new assembly load context
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
VERBOSE: Loading PSES DLL using new assembly load context
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
VERBOSE: Loading PSES DLL using new assembly load context
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
VERBOSE: Loading PSES DLL using new assembly load context
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
VERBOSE: Loading PSES DLL using new assembly load context
DEBUG: Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Culture=neutral, PublicKeyToken=null
VERBOSE: Loading PSES DLL using new assembly load context
DEBUG: Assembly resolve event fired for System.Management.Automation.resources, Version=7.2.3.500, Culture=de-DE, PublicKeyToken=31bf3856ad364e35
DEBUG: Assembly resolve event fired for System.Management.Automation.resources, Version=7.2.3.500, Culture=de, PublicKeyToken=31bf3856ad364e35
DEBUG: Loaded into load context "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0: Microsoft.PowerShell.EditorServices.VSCode, Version=3.3.4.0, Culture=neutral, PublicKeyToken=null
PS > VERBOSE: Debug server started

Activity

  1. ghost added
    Needs: TriageMaintainer attention needed!
    on May 4, 2022
  2. Hetshu commented on May 4, 2022

    @Hetshu

    I have the same Problem. It started when switching from Preview to Productive Extension. And I can't get rid of it by switching back to preview. Using WinPS 5.1 here, vscode 1.66.2 , ps ext 2022.5.0. Never had this problem before with all previous preview versions up to and including 2022.4.3. Reverting back to preview 2022.4.3 now does not fix the problem.
    PS: Hitting Return in the terminal after F5 starts the debugger. Ctrl F5 is also affected. F10 after breakpoint is also affected.

  3. pwahlmueller commented on May 4, 2022

    @pwahlmueller

    Same here.
    Disabling all other extensions, all profiles and all settings did not help either.

  4. andyleejordan commented on May 4, 2022

    @andyleejordan
    Member

    I think I know what's going on here. As a workaround, when the temporary console is created, can you press a key in it (any key, enter is fine) to let it start?

  5. ohaak2 commented on May 4, 2022

    @ohaak2
    Author

    Andy Jordan (@andschwa) Yes, indeed. It's like Hetshu already commented.

    That way the script will be executed in run mode or I will hit the first breakpoint in debug mode, but going on from there with F10 or F11 will each also require a key stroke in the terminal.

  6. andyleejordan commented on May 4, 2022

    @andyleejordan
    Member

    Sorry about that! We'll get it fixed right away.

  7. ohaak2 commented on May 4, 2022

    @ohaak2
    Author

    Andy Jordan (@andschwa) Awesome - thanks! Would be lost without your magnificent work here!

  8. andyleejordan commented on May 4, 2022

    @andyleejordan
    Member

    We'd be lost without our users and your prompt and specific bug reports!

  9. andyleejordan commented on May 5, 2022

    @andyleejordan
    Member

    Good news: I have a fix underway that seems to be working! Getting PRs up now, will have this in preview for testing ASAP!

  10. changed the title [-]PowerShell session not loaded when powershell.debugging.createTemporaryIntegratedConsole set to 'true'[/-] [+]Temporary integrated consoles stuck waiting for key press[/+] on May 5, 2022
  11. moved this from Todo to In Progress in American Pharoah on May 5, 2022
  12. Repository owner moved this from In Progress to Done in American Pharoah on May 5, 2022
  13. andyleejordan commented on May 6, 2022

    @andyleejordan
    Member

    Ole Rühaak (@ohaak2), Hetshu, Patrick Wahlmueller (@pwahlmueller): Just published v2022.5.1-preview with a fix for this. Will be on the marketplace shortly! Please give it a test for me.

  14. ohaak2 commented on May 6, 2022

    @ohaak2
    Author

    Andy Jordan (@andschwa) Just switched my vscode to use the preview. Looks good - your fix seems to work. Good work - Thx!

  15. andyleejordan commented on May 6, 2022

    @andyleejordan
    Member

    Awesome, thanks so much for the verification!

  16. Hetshu commented on May 6, 2022

    @Hetshu

    Yes worked for me too, thanks for the fast fixing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions