PowerShell / PSReadLine

A bash inspired readline implementation for PowerShell
BSD 2-Clause "Simplified" License
3.77k stars 298 forks source link

Exception in PSReadLine: ArgumentOutOfRangeException #4224

Closed Danesh-007 closed 1 month ago

Danesh-007 commented 1 month ago

Prerequisites

Exception report

System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: left
Actual value was -2.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

Screenshot

Capture

Environment data

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

Name              : PSReadline
Path              : C:\Program Files\WindowsPowerShell\Modules\PSReadline\2.0.0\PSReadLine.psm1
Description       : Great command line editing in the PowerShell console host
Guid              : 5714753b-2afd-4492-a5fd-01d9e2cff8b5
Version           : 2.0.0
ModuleBase        : C:\Program Files\WindowsPowerShell\Modules\PSReadline\2.0.0
ModuleType        : Script
PrivateData       : {PSData}
AccessMode        : ReadWrite
ExportedAliases   : {}
ExportedCmdlets   : {[Get-PSReadLineKeyHandler, Get-PSReadLineKeyHandler], [Get-PSReadLineOption,
                    Get-PSReadLineOption], [Remove-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler],
                    [Set-PSReadLineKeyHandler, Set-PSReadLineKeyHandler]...}
ExportedFunctions : {[PSConsoleHostReadLine, PSConsoleHostReadLine]}
ExportedVariables : {}
NestedModules     : {Microsoft.PowerShell.PSReadLine}

Name           : ConsoleHost
Version        : 5.1.19041.5007
InstanceId     : d047ff35-8637-484e-8728-e5e2730ec064
ProductVersion :

ErrorForegroundColor    : Red
ErrorBackgroundColor    : Black
WarningForegroundColor  : Yellow
WarningBackgroundColor  : Black
DebugForegroundColor    : Yellow
DebugBackgroundColor    : Black
VerboseForegroundColor  : Yellow
VerboseBackgroundColor  : Black
ProgressForegroundColor : Yellow
ProgressBackgroundColor : DarkCyan

Steps to reproduce

Steps to Reproduce:

  1. Open PowerShell.
  2. Navigate to the directory: cd "E:\C Programming Challenges\4"
  3. Attempt to compile the C program: gcc 1.c -o 1
  4. Observe the following error message: c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot open output file 1.exe: Permission denied collect2.exe: error: ld returned 1 exit status
  5. If you run the existing executable: .\1
  6. The program prompts for input: Enter a number: 10 And produces the expected output: Multiplication table of 10 is: 10 x 1 = 10 ... 10 x 10 = 100

Expected behavior

Expected Behavior:

The command gcc 1.c -o 1 should compile the program and create an executable named 1.exe.

Actual behavior

Actual Behavior:

An error message stating "Permission denied" occurs when attempting to compile the program.

github-actions[bot] commented 1 month ago

This issue was already fixed (see #1306). Please upgrade to the 2.3.5 version of PSReadLine from PowerShell Gallery. See the upgrading section for instructions. Please let us know if you run into the same issue with the latest version.