From 22a3a896ee016336ae067dc1d98220c55af05266 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 5 Jun 2017 13:17:26 -0700 Subject: [PATCH] Silently ignore failure on GetConsoleFontInfoEx() api call (#3937) The api is available on ServerCore but fails (returns false) running in container. Silently ignoring the failure allows PSReadline to work. --- src/Microsoft.PowerShell.PSReadLine/ConsoleLib.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Microsoft.PowerShell.PSReadLine/ConsoleLib.cs b/src/Microsoft.PowerShell.PSReadLine/ConsoleLib.cs index 98b9eb6658..4451f95a1f 100644 --- a/src/Microsoft.PowerShell.PSReadLine/ConsoleLib.cs +++ b/src/Microsoft.PowerShell.PSReadLine/ConsoleLib.cs @@ -727,9 +727,7 @@ namespace Microsoft.PowerShell.Internal if (result == false) { - int err = Marshal.GetLastWin32Error(); - Win32Exception innerException = new Win32Exception(err); - throw new Exception("Failed to get console font information.", innerException); + _getCurrentConsoleFontExApiAvailable = false; // api not supported on ServerCore } return fontInfo; }