Skip to content

System.ArgumentOutOfRangeException: #5226

Closed

Description

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

Last 200 Keys:
 e m ( ) ) ) Enter
 p r i n t ( " M a x i m u m Space p e r t u r b a t i o n : " , Space d e l t a . m a x ( ) . i t e m ( ) ) Enter
 p r i n t ( " W i t h i n Space e p s i l o n : " , Space b o o l ( d e l t a . m a x ( ) Space < = Space e p s i l o n Space + Space 1 e - 6 ) ) Enter
 p r i n t ( " F i n i t e Space o u t p u t s : " , Space b o o l ( t o r c h . i s f i n i t e ( x _ a d v ) . a l l ( ) . i t e m ( ) ) ) Enter
 ' @ Space | Space p y t h o n Space -

Exception:
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: top
Actual value was -22.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   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

Image

Environment data

PS Version: 5.1.19041.6456
PS HostName: ConsoleHost
PSReadLine Version: 2.0.0-beta2
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 134
BufferHeight: 40

Steps to reproduce

https://github.com/BoJack-Horse-man/adversarial-robustness-lab I WAS PRACTICING WHEN I HAVE THIS ISSUE. I RUN @'
import sys
sys.path.insert(0, r"..\hydra-reference")

import torch
import models
from utils.model import get_layers, prepare_model
from utils.adv import pgd_whitebox
from types import SimpleNamespace

torch.manual_seed(42)
args = SimpleNamespace(
layer_type="subnet",
exp_mode="pretrain",
k=1.0,
freeze_bn=False,
scores_init_type="kaiming_normal",
)

conv, linear = get_layers("subnet")
model = models.cifar_model(
conv, linear, "kaiming_normal", num_classes=10
).cuda()
prepare_model(model, args)
model.eval()

x = torch.rand(4, 3, 32, 32, device="cuda")
y = torch.randint(0, 10, (4,), device="cuda")
epsilon = 8 / 255

with torch.no_grad():
x_adv = pgd_whitebox(
model, x, y, torch.device("cuda"),
epsilon, 3, 2 / 255, 0.0, 1.0, is_random=True
)

delta = (x_adv - x).abs()
print("Output shape:", tuple(x_adv.shape))
print("Pixels within [0,1]:", bool((x_adv.min() >= 0).item() and (x_adv.max() <= 1).item()))
print("Maximum perturbation:", delta.max().item())
print("Within epsilon:", bool(delta.max() <= epsilon + 1e-6))
print("Finite outputs:", bool(torch.isfinite(x_adv).all().item()))
'@ | python - THIS ONE WHEN BUG APPEAR

Expected behavior

Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new

Exception:
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: top
Actual value was -23.
at System.Console.SetCursorPosition(Int32 left, Int32 top)
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(Nullable1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

Actual behavior

Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new

Exception:
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: top
Actual value was -23.
at System.Console.SetCursorPosition(Int32 left, Int32 top)
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(Nullable1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

Activity

  1. github-actions commented on Oct 24, 2026

    @github-actions

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions