You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unregister-Event inside its own action deadlocks the interactive prompt (input is never read) #28379
Then type anything at the first prompt. Nothing is echoed.
A single registration does not reproduce; two do. This matches the note in #16154 that
the hang needs another action pending when Unregister-Event runs.
The real-world session that led to this report showed the same stack: the process was
alive at 0% CPU with 110 bytes of keystrokes queued in the tty input buffer.
Expected behavior
Unregister-Event returns and the prompt keeps accepting input.
Actual behavior
The shell stops reading stdin. The process stays alive at ~0% CPU, the tty is in raw
mode, and the tty input queue accumulates typed bytes. The session has to be killed.
Error details
Managed stack of the pipeline thread (sample plus DOTNET_PerfMapEnabled, pwsh 7.6.9):
PSConsoleReadLine.ReadLine
PSConsoleReadLine.InputLoop
PSConsoleReadLine.ReadKey
PowerShell.Invoke
PSLocalEventManager.ProcessPendingActionsImpl
PSLocalEventManager.InvokeAction
PSEventJob.Invoke
ScriptBlock.InvokeWithPipe
UnregisterEventCommand.ProcessRecord
PSLocalEventManager.UnsubscribeEvent
PSLocalEventManager.DrainPendingActions
Thread.Sleep(int32) # waits for the action that is itself running
Because the action is dispatched from inside PSConsoleReadLine.ReadKey, blocking the
pipeline thread also stops terminal input from being read.
Environment data
Name Value
---------
PSVersion 7.6.9
PSEdition Core
GitCommitId 7.6.9
OS macOS 27.2.0
Platform Unix
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Activity