lost console while typing at prompt #22358

Closed
opened 2026-01-31 08:10:48 +00:00 by claunia · 2 comments
Owner

Originally created by @malfaux on GitHub (Oct 8, 2024).

Windows Terminal version

1.21.2701.0

Windows build number

10.0.22631.0

Other Software

PSVersion 7.4.5
PSEdition Core
GitCommitId 7.4.5
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Steps to reproduce

heisenbug

Expected Behavior

not to crash?

Actual Behavior

An error has occurred that was not properly handled. Additional information is shown below. The PowerShell process will exit.
Unhandled exception. System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
at System.ConsolePal.ReadKey(Boolean intercept)
at Microsoft.PowerShell.Internal.VirtualTerminal._TryIgnoreIOE[T](Func`1 f)
at Microsoft.PowerShell.PSConsoleReadLine.ReadOneOrMoreKeys()
at Microsoft.PowerShell.PSConsoleReadLine.ReadKeyThreadProc()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

[process exited with code 3762504530 (0xe0434352)]
You can now close this terminal with Ctrl+D, or press Enter to restart.

Originally created by @malfaux on GitHub (Oct 8, 2024). ### Windows Terminal version 1.21.2701.0 ### Windows build number 10.0.22631.0 ### Other Software PSVersion 7.4.5 PSEdition Core GitCommitId 7.4.5 OS Microsoft Windows 10.0.22631 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 ### Steps to reproduce heisenbug ### Expected Behavior not to crash? ### Actual Behavior An error has occurred that was not properly handled. Additional information is shown below. The PowerShell process will exit. Unhandled exception. System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read. at System.ConsolePal.ReadKey(Boolean intercept) at Microsoft.PowerShell.Internal.VirtualTerminal._TryIgnoreIOE[T](Func`1 f) at Microsoft.PowerShell.PSConsoleReadLine.ReadOneOrMoreKeys() at Microsoft.PowerShell.PSConsoleReadLine.ReadKeyThreadProc() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) [process exited with code 3762504530 (0xe0434352)] You can now close this terminal with Ctrl+D, or press Enter to restart.
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 08:10:48 +00:00
Author
Owner

@lhecker commented on GitHub (Oct 8, 2024):

This is an issue that I encountered as well at one point while debugging PowerShell behavior. I believe this may be a race condition in PowerShell itself and not in Windows Terminal.

@lhecker commented on GitHub (Oct 8, 2024): This is an issue that I encountered as well at one point while debugging PowerShell behavior. I believe this may be a race condition in PowerShell itself and not in Windows Terminal.
Author
Owner

@DHowett commented on GitHub (Oct 8, 2024):

Indeed - would you be able to file it over at the PowerShell repo?

@DHowett commented on GitHub (Oct 8, 2024): Indeed - would you be able to file it over at [the PowerShell repo](https://github.com/powershell/powershell)?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22358