PowerShell / PowerShell/vscode-powershell

Read-Host and PromptForChoice produce repeated 'e' characters in terminal

Aperta
#5,240 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Issue-Bug Needs: Maintainer Attention
Lingua principale
TypeScript
Stelle
1.9k
Fork
548
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all open and closed 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

When using the PowerShell extension in Visual Studio Code, terminal input via '$Host.UI.PromptForChoice' or 'Read-Host' and pressing any key results in console output that writes the pressed key followed by a lot of unexpected 'e' characters (until the cursor is at the beginning of the next line).

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

Name             : Visual Studio Code Host
Version          : 2025.2.0
InstanceId       : f1e654dd-cac2-444b-b72c-509651f0547b
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : de-DE
CurrentUICulture : de-DE
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
1.102.0
cb0c47c0cfaad0757385834bd89d410c78a856c0
x64
Extension Version
adamwojcikit.pnp-←[7mpowershell←[0m-extension@3.0.40
ms-vscode.←[7mpowershell←[0m@2025.2.0
Steps to Reproduce

Use any version of Visual Studio Code between 1.98.x and the recent version 1.102.0 with the respective recent version of the 'PowerShell' extension and execute any code with '$Host.UI.PromptForChoice' or 'Read-Host'.

Example code:

Write-Host "This is a test. 🙂"
Read-Host "Press any key to continue ..."

Known workarounds:

Option 1: Use Visual Studio Code version 1.97.2 or older.

Option 2: When setting 'terminal.integrated.windowsEnableConpty' to 'false' to use WinPTY instead of ConPTY the problem is gone, but with WinPTY there is no UTF/Unicode support.

Visuals

Described issue (count of 'e' characters depends on terminal width):
Image

Workaround (option 2) with WinPTY instead of ConPTY:
Image

Logs

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

  • Editor Services version: 4.3.0
  • Build origin: AzureDevOps-CI
  • Build commit: 886e91406390a01e74fa423d352594f92d483be3
  • Build time: 26.06.2025 00:00:00

DEBUG:
== Host Startup Configuration Details ==

  • Host name: Visual Studio Code Host

  • Host version: 2025.2.0

  • Host profile ID: Microsoft.VSCode

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

  • REPL setting: PSReadLine

  • Session details path: c:\Users\User\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-42520-469421.json

  • Bundled modules path: c:\Users\User.vscode\extensions\ms-vscode.powershell-2025.2.0\modules

  • Additional modules:

  • Feature flags:

  • Log path: c:\Users\User\AppData\Roaming\Code\logs\20250717T081553\window1\exthost\ms-vscode.powershell

  • Minimum log level: Trace

  • Profile paths:

    • AllUsersAllHosts: C:\Program Files\PowerShell\7\profile.ps1
    • AllUsersCurrentHost: C:\Program Files\PowerShell\7\Microsoft.VSCode_profile.ps1
    • CurrentUserAllHosts: C:\Users\User\OneDrive\Dokumente\PowerShell\profile.ps1
    • CurrentUserCurrentHost: C:\Users\User\OneDrive\Dokumente\PowerShell\Microsoft.VSCode_profile.ps1

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

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

DEBUG:
== Environment Details ==

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

DEBUG: [Trace]
== PowerShell Details ==

  • PowerShell version: 7.4.11
  • Language mode: ConstrainedLanguage

DEBUG: [Trace] Updated PSModulePath to: 'C:\Users\User\OneDrive\Dokumente\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;c:\Users\User.vscode\extensions\ms-vscode.powershell-2025.2.0\modules'
DEBUG: Validating configuration
VERBOSE: Loading PowerShell Editor Services Assemblies
DEBUG: [Trace] Assembly resolve event fired for Microsoft.PowerShell.EditorServices, Version=4.3.0.0, Culture=neutral, PublicKeyToken=null
DEBUG: Loading PSES DLL using new assembly load context
DEBUG: [Trace] Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.PowerShell.EditorServices, Version=4.3.0.0, Culture=neutral, PublicKeyToken=null
VERBOSE: Starting PowerShell Editor Services
DEBUG: [Trace] Loaded into load context "PsesLoadContext" Microsoft.PowerShell.EditorServices.Hosting.PsesLoadContext #1: Microsoft.Extensions.Logging.Abstractions, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Type 'help' to get help.

PS C:\development\git\KUD-EAL-Adressatenverwaltung-O365> cd ../../development
Set-Location: Cannot find path 'C:\development\development' because it does not exist.
PS C:\development\git\KUD-EAL-Adressatenverwaltung-O365> cd ../../../development
PS C:\development>
PS C:\development> . $args[0] Write-Host "This is a test. 🙂"
Read-Host "Press any key to continue ..."

This is a test. 🙂
Press any key to continue ...: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
PS C:\development>

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il problema con Read-Host o $Host.UI.PromptForChoice in Visual Studio Code 1.102.0 usando ConPTY, quindi confronta il comportamento con WinPTY e VS Code 1.97.2. Traccia il percorso dell’input del terminale nell’estensione e verifica che la pressione di un tasto non produca più caratteri ripetuti, preservando il supporto Unicode.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript, vscode
Ambito
cli, developer-experience
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.