vscode-powershell
vscode-powershell copied to clipboard
Read-Host and PromptForChoice produce repeated 'e' characters in terminal
Prerequisites
- [x] I have written a descriptive issue title.
- [x] I have searched all open and closed issues to ensure it has not already been reported.
- [x] I have read the troubleshooting guide.
- [x] I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- [x] 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←[[email protected]
ms-vscode.←[7mpowershell←[[email protected]
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):
Workaround (option 2) with WinPTY instead of ConPTY:
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>