Skip to content

System.ArgumentOutOfRangeException when starting VSCode's integrated debugger #4199

@DDianovMD

Description

@DDianovMD

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

Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 200 Keys:
 r s \ \ U s e r \ \ A p p D a t a \ \ L o c a l \ \ T e m p \ \ n o d e - d e b u g - c a l l b a c k - 0 6 8 f c a 3 b 6 2 2 5 2 f a e " } ' ; Space & Space ' C : \ P r o g r a m Space F i l e s \ n o d e j s \ n o d e . e x e ' Space ' C : \ U s e r s \ U s e r \ s o u r c e \ r e p o s \ i n p u t - v a l i d a t o r / n o d e _ m o d u l e s / j e s t / b i n / j e s t . j s ' Space ' - - r u n I n B a n d ' Space Enter


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 -2.
   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.4894
PS HostName: ConsoleHost
PSReadLine Version: 2.0.0-beta2
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 140
BufferHeight: 36

Steps to reproduce

  1. Run npm init -y inside Visual Studio Code's integrated terminal (I suppose that Node is already installed on your machines).

  2. Use the following settings and dependencies in package.json:
    { "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "files": [ "dist" ], "scripts": { "build": "tsup", "test": "jest" }, "devDependencies": { "@jest/globals": "^29.7.0", "@types/jest": "^29.5.13", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "ts-jest": "^29.2.5", "ts-node": "^10.9.2", "tsup": "^8.3.0", "typescript": "^5.6.2" } }

  3. Install dependent libraries

  4. Use with the following launch.json file inside .vscode folder:
    { "version": "0.2.0", "configurations": [ { "name": "Debug Jest Tests", "type": "node", "request": "launch", "runtimeArgs": [ "--inspect-brk", "${workspaceRoot}/node_modules/jest/bin/jest.js", "--runInBand" ], "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" } ] }

  5. Use the following tsup.config.ts:
    import { defineConfig } from "tsup"; export default defineConfig({ entry: ["src/index.ts"], format: ["cjs", "esm"], dts: true, splitting: false, sourcemap: true, clean: true, });

  6. Use the following jest.config.js
    module.exports = { preset: "ts-jest", testEnvironment: "jsdom", };

Here's a screenshot of the project folder with these config files
image

  1. Write simple unit test using Jest library and press F5 to run it with Visual Studio Code's debugger - the exception is thrown inside integrated powershell terminal.

Expected behavior

I expect this report to help fixing the issue.

Actual behavior

I ran into this error when starting the VSCode debugger to debug some failing unit tests written with Jest for a TypeScript project.

The exception is thrown in the integrated PowerShell terminal inside VSCode a few times then the unit tests run without any problem. Even though there are exceptions the debugger is starting and working without problems.

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