I'm getting an error saying bottom cannot be greater than or equal to top.
I'm using the Rectangle
constructor documented here: https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.host.rectangle.-ctor?view=powershellsdk-1.1.0#System_Management_Automation_Host_Rectangle__ctor_System_Int32_System_Int32_System_Int32_System_Int32_
This is my relevant section of code;
Console.WriteLine("setting rectangles: " + sizex +", " +sizey);
int screenTop = sizey;
int screenBottom = 1;
int statusTop = 1;
int statusBottom = 0;
Console.WriteLine ("screen top bottom; "+screenTop + " > " + screenBottom );
Console.WriteLine ("status top bottom; "+statusTop + " > " + statusBottom );
// Rectangle(int left, int top, int right, int bottom);
System.Management.Automation.Host.Rectangle screenWindowRect = new Rectangle(0,screenTop,sizex,screenBottom);
System.Management.Automation.Host.Rectangle statusLineRect = new Rectangle(0,statusTop,sizex,statusBottom);
Console.WriteLine("rectangles set");
I see the debug lines before the constructors, but never the "rectangles set" message.
This is the output;
setting rectangles: 241, 28
screen top bottom; 28 > 1
status top bottom; 1 > 0
Out-Less: "bottom" cannot be greater than or equal to "top".
I can see that top is greater than bottom but I keep getting the error; "bottom" cannot be greater than or equal to "top"
Is this a bug, or documentation error, or is there something I'm missing.
The error message misstates the actual error condition:
should be:
In other words: the
bottom
argument must be equal to or greater than thetop
argument - and, analogously,right
must be equal to or greater thanleft
:You can verify this in PowerShell itself: