question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UI width, possibly word wrap, in PowerShell Integrated console is causing an input error while debugging

See original GitHub issue

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.

Summary

I have a PowerShell script that prompts a user input via Read-Host command. I reduced the width of the PowerShell integrated console terminal just right at the edge of the prompt and it returns error. however, by widening the UI width fixes the issue.

Please see below for the error:

Do you also want to generate FULL PERMS html reports from the Delegation dataset? (y/n):y (<-- my input would sit very edge of the terminal UI) Read-Host Prompt failed, check inner exception for details At \execweb\Toolbox\frhwang\0NetworkRepo\ExecMailboxAudit-onPrem\Start-ESSMailboxAudit. ps1:71 char:18

  • … nSection5 = Read-Host -Prompt "Do you also want to generate FULL PERM …
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (😃 [Read-Host], Exception
    • FullyQualifiedErrorId : System.Exception,Microsoft.PowerShell.Commands.ReadHostCo mmand

PowerShell Version

$PSVersionTable


Name                           Value
----                           -----
PSVersion                      5.1.19041.1237
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1237
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Visual Studio Code Version

code --version
1.60.2
7f6ab5485bbc008386c4386d08766667e155244e
x64

Extension Version

code --list-extensions --show-versions | Select-String powershell

ms-vscode.powershell@2021.9.2

Steps to Reproduce

  1. while in debugging, invoke a read-host prompt with some prompt sentence and have the input cursor sit at the very last line of the available width of the terminal. (if cursor warp to the next line, invoke it again)
  2. type something as an input. it will trigger the read-host prompt failed error.
  3. you can immediately remedy this by widening the UI or shortening it for the prompt to warp to the next line.

I can reproduce this at will. please contact me if you have a hard time reproducing it.

Visuals

image

Logs

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
rjmholtcommented, Oct 5, 2021

Yeah the following will help us to reproduce the issue:

  • The Read-Host part of the script with the full prompt
  • The result of [console]::windowwidth
  • The result of gmo PSReadLine and gcm PSConsoleHostReadLine
1reaction
LNGUcommented, Oct 6, 2021

so dragging UI has to happen. I had to drag between 73 and 72 in micro movement to repro this. If there is a value that tracks in smaller increments than whole numbers, please let me know. maybe recording screen would be a better option here.

PS C:\temp\ExecMailboxAudit-onPrem> [console]::windowwidth
73
PS C:\temp\ExecMailboxAudit-onPrem> Read-Host -Prompt "Do you want to generate html reports from the Delegation dataset? (y/n)"                 
Do you want to generate html reports from the Delegation dataset? (y/n):**Read-Host: Prompt failed, check inner exception for details**  (my response y was overwritten by the error msg)            
PS C:\temp\ExecMailboxAudit-onPrem> [console]::windowwidth
72
ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.1.0                 PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove…

CommandType     Name                                               Version    Source    
-----------     ----                                               -------    ------    
Function        PSConsoleHostReadLine                              2.1.0      PSReadLine
Read more comments on GitHub >

github_iconTop Results From Across the Web

Word Wrap STILL Not Working on PowerShell Integrated ...
I have observed the following: Fill the console with characters up to 99%; As one tries to type the next character, the following...
Read more >
User and Workspace Settings - Visual Studio Code
on : Lines will wrap at the viewport width. // - inherit: Lines will wrap according to the `editor.wordWrap` setting. "diffEditor.wordWrap": "inherit" ...
Read more >
All other Tokyo fixes - Product Documentation | ServiceNow
In the compose section, the text input in 'Comments' isn't hidden when setting the action from 'visible' to 'false' using the UI policy....
Read more >
Automate Desktop and Automate Plus/Ultimate - Fortra
The HTTP action's "Authentication type" parameter now displays all available types, based on the HTTP activity being used. The PowerShell action no longer ......
Read more >
Integration Services Error and Message Reference
Hexadecimal code Decimal Code Symbolic Name 0x8002F347 ‑2147290297 DTS_E_STOREDPROCSTASK_OVERWRITINGSPATD... 0x8020837E ‑2145352834 DTS_E_ADOSRCUNKNOWNTYPEMAPPEDTONTEXT 0x8020838C ‑2145352820 DTS_E_XMLSRCSCHEMACOLUMNNOTINEXTERNAL...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found