-
Notifications
You must be signed in to change notification settings - Fork 315
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 11 Keys:
& Space C : / U s e r s /
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: 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
PSReadLine crashes with System.ArgumentOutOfRangeException when typing a file path in PowerShell console.
Environment data
Get-Module PSReadLine
$PSVersionTable
[System.Environment]::OSVersion
$Host.UI.RawUI.WindowSize
$Host.UI.RawUI.BufferSize
Steps to reproduce
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv('C:/Users/user/Desktop/ML/data/data/daily-data.csv')
Create a figure with multiple subplots
fig, axes = plt.subplots(2, 2, figsize=(20, 15))
sns.histplot(df['Country'], ax=axes[0,0],
bins=20, kde=True, color='skyblue')
axes[0,0].set_title('Histogram of Your Numeric Column')
axes[0,0].set_xlabel('Value')
axes[0,0].set_ylabel('Frequency')
sns.boxplot(data=df['New_cases'], ax=axes[0,1],
orient='v', color='lightgreen')
axes[0,1].set_title('Box Plot of Your Numeric Column')
axes[0,1].set_ylabel('Value')
sns.violinplot(data=df['New_deaths'], ax=axes[1,0],
orient='v', color='salmon')
axes[1,0].set_title('Violin Plot of Your Numeric Column')
axes[1,0].set_ylabel('Value')
numeric_columns = ['Country', 'New_cases', 'New_deaths']
sns.pairplot(df[numeric_columns], diag_kind='kde',
markers=['o', 's', 'D'], palette='husl')
plt.tight_layout()
plt.show()
Expected behavior
It should be possible to type commands and file paths in the PowerShell console without any issues. Regardless of the console buffer size or cursor position, PSReadLine should manage console rendering correctly and the cursor should move easily as characters are typed.
Actual behavior
PSReadLine crashes with a System.ArgumentOutOfRangeException when typing a file path. The error occurs when the cursor position calculation results in a negative value (-2), causing the console to fail when trying to set the cursor position. This completely interrupts the command input and prevents normal PowerShell usage.
The crash happens specifically when typing: & Space C : / U s e r s /
Error details:
- Cursor left position calculated as -2 (invalid)
- Console buffer size validation fails
- PSReadLine rendering system crashes
- Command input is completely interrupted