From 3ae517f486755629c23ac0ea7b141a17ffe3c78c Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Tue, 30 Sep 2025 20:37:33 +0100 Subject: [PATCH 1/2] Check for `GetWindowPlacement` success --- test/powershell/Host/ConsoleHost.Tests.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index 12da91bf19e..95ad8e08450 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -985,7 +985,12 @@ public static WINDOWPLACEMENT GetPlacement(IntPtr hwnd) { WINDOWPLACEMENT placement = new WINDOWPLACEMENT(); placement.length = Marshal.SizeOf(placement); - GetWindowPlacement(hwnd, ref placement); + + if (!GetWindowPlacement(hwnd, ref placement)) + { + throw new Win32Exception(); + } + return placement; } From 2433149596f11bbb571e991da501113dafd8ed03 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Wed, 8 Oct 2025 19:00:44 +0100 Subject: [PATCH 2/2] fix CS0246 --- test/powershell/Host/ConsoleHost.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index 95ad8e08450..a07e7b6082a 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -988,7 +988,7 @@ public static WINDOWPLACEMENT GetPlacement(IntPtr hwnd) if (!GetWindowPlacement(hwnd, ref placement)) { - throw new Win32Exception(); + throw new System.ComponentModel.Win32Exception(); } return placement;