Get it on windows 10 with PowerShell-6.0.0-alpha.18-win10-win2016-x64 and version 5.1.15063.0 (coming with creators update)
read-host -AsSecureStringThere is a star in console for each pasted character. On enter everything is going to be returned as secure string
There is shown one star and clipboard content is shown in promt (without first two characters)
Value of $StackTrace variable just after execution is
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Name Value
---- -----
PSVersion 5.1.15063.0
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.0
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
and
SerializationVersion 1.1.0.1
CLRVersion
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSEdition Core
GitCommitId v6.0.0-alpha.18
BuildVersion 3.0.0.0
PSRemotingProtocolVersion 2.3
PSVersion 6.0.0-alpha
WSManStackVersion 3.0
I can confirm that Issue is only on Windows 10 Creator with both Alfa.17 and Alfa.18.
@iSazonov: you're not seeing this on Anniversary Update or earlier? If so, my hunch is that something changed in conhost with Creators Update.
In 10586 no problem.
It seems this is not a problem with pasting, but a problem with the speed at which characters are entered into the stream.
For example, if you run Read-Host -AsSecureString, and press "j" and "k" at the same time, the same problem happens.
@lzybkr Could you please comment the Issue?
I have reproduced the issue in Windows PowerShell and PowerShell Core on Creators Update, but have not investigated further.
I pinged the conhost folks and they are not aware of any issues like this. We'll open an issue with them and figure it out - it could still come back to PowerShell if our console api usage is somehow really wrong.
Saw the thread with the conhost folks and they understand the issue on their side
@SteveL-MSFT I've been bitten by this as well. Unfortunately, we have important scripts that depend a lot on this functionality. Is there an issue I can watch/monitor for the progress on the underlying problem?
Or is there a rough time estimate (i.e. days, weeks, months) on when this will be fixed? I'm asking because I'm trying to figure out whether I should implement a workaround for this problem.
Workaround: You can use the PowerShell terminal in Visual Studio Code as workaround. This terminal isn't affected by the problem.
@skrysmanski This doesn't repro for me on latest Win10 fast lane flight (specifically build 16197)
The workaround mentioned by @skrysmanski did not work for me. I ended up using a hotkey tool (Autohotkey) to "type" the contents of the clipboard instead of pasting it.
I'm seeing a similar issue on Windows 10 1703 where typing too quickly into a Read-Host -AsSecureString prompt will forcefully terminate the running script without throwing an exception or any other indication that there was a problem.
EDIT: viewing the contents of $StackTrace does show the same exception as the original poster
For example: typing "asdf;lkjasdf;lkjasdf;lkjasd" very rapidly succession will cause the script to terminate.
Is there a linked issue somewhere that the progress of this can be viewed?
@crossan007 I'm not seeing a repro on Win10 1703 (10.0.16278). Unfortunately, I believe the conhost issues are tracked only internally. Maybe open an issue here
See below for reproduction:

I'll open an issue at the link you provided.
It seems this issue is fixed on Windows 10 Version 1709 (Build 16299.64).
The PowerShell version is 5.1 Build 16299 Revision 64.
Windows 10 Version (OS Build 16299.214).
Run Read-Host -AsSecureString and ctrl+v pastes one star but right click pastes all stars.
Microsoft Windows [Version 10.0.17083.1000]
WSL = DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
All good!
Most helpful comment
I have reproduced the issue in Windows PowerShell and PowerShell Core on Creators Update, but have not investigated further.
I pinged the
conhostfolks and they are not aware of any issues like this. We'll open an issue with them and figure it out - it could still come back to PowerShell if our console api usage is somehow really wrong.