From 28b3ff14ff39458e4ba44d91f3218e5a689d996f Mon Sep 17 00:00:00 2001 From: iSazonov Date: Mon, 1 Oct 2018 18:17:24 +0500 Subject: [PATCH 1/3] Remove dumb code - args is never null - the code is not used --- src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs index 07f7dba601c..38b0fe2540b 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs @@ -163,11 +163,6 @@ internal static int Start( hostException = e; } - if (args == null) - { - args = new string[0]; - } - s_cpp = new CommandLineParameterParser( (s_theConsoleHost != null) ? s_theConsoleHost.UI : (new NullHostUserInterface()), bannerText, helpText); From ae7154f15d6f63e8fd677fd1ea79907312fe4742 Mon Sep 17 00:00:00 2001 From: iSazonov Date: Mon, 1 Oct 2018 18:18:09 +0500 Subject: [PATCH 2/3] Remove unneeded args cloning --- src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs index 38b0fe2540b..63cb98bec8c 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs @@ -148,9 +148,6 @@ internal static int Start( try { - string[] tempArgs = new string[args.GetLength(0)]; - args.CopyTo(tempArgs, 0); - // We might be able to ignore console host creation error if we are running in // server mode, which does not require a console. HostException hostException = null; @@ -167,7 +164,7 @@ internal static int Start( (s_theConsoleHost != null) ? s_theConsoleHost.UI : (new NullHostUserInterface()), bannerText, helpText); - s_cpp.Parse(tempArgs); + s_cpp.Parse(args); #if UNIX // On Unix, logging has to be deferred until after command-line parsing From d0d0300bd8991b2e68762a686acdac578750f217 Mon Sep 17 00:00:00 2001 From: iSazonov Date: Fri, 12 Oct 2018 08:58:36 +0500 Subject: [PATCH 3/3] [Feature]