From 5bd8dd351f68927ce22804ea64d883bb5741b987 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Thu, 12 Oct 2017 10:18:24 -0700 Subject: [PATCH] removed `#if CORECLR` statements merging code base --- .../host/msh/ConsoleHost.cs | 32 ++----------------- .../host/msh/ConsoleShell.cs | 1 - 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs index 56d80e6d71..043dcd5b70 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs @@ -890,11 +890,7 @@ namespace Microsoft.PowerShell { lock (hostGlobalLock) { -#if !CORECLR - return NativeCultureResolver.Culture; -#else return CultureInfo.CurrentCulture; -#endif } } } @@ -915,11 +911,7 @@ namespace Microsoft.PowerShell { lock (hostGlobalLock) { -#if !CORECLR - return NativeCultureResolver.UICulture; -#else return CultureInfo.CurrentUICulture; -#endif } } } @@ -1115,10 +1107,8 @@ namespace Microsoft.PowerShell this.ui = new ConsoleHostUserInterface(this); _consoleWriter = new ConsoleTextWriter(ui); -#if !CORECLR // CurrentDomain.UnhandledException not supported on CoreCLR UnhandledExceptionEventHandler handler = new UnhandledExceptionEventHandler(UnhandledExceptionHandler); AppDomain.CurrentDomain.UnhandledException += handler; -#endif } private void BindBreakHandler() @@ -1131,7 +1121,6 @@ namespace Microsoft.PowerShell #endif } -#if !CORECLR // Not used on NanoServer: CurrentDomain.UnhandledException not supported on CoreCLR private void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs args) { // FYI: sender is a reference to the source app domain @@ -1155,7 +1144,6 @@ namespace Microsoft.PowerShell ConsoleHostStrings.UnhandledExceptionShutdownMessage); ui.WriteLine(); } -#endif /// /// @@ -2891,7 +2879,7 @@ namespace Microsoft.PowerShell base(message) { } -#if !CORECLR // ApplicationException & System.Runtime.Serialization.SerializationInfo are Not In CoreCLR + protected ConsoleHostStartupException( System.Runtime.Serialization.SerializationInfo info, @@ -2900,7 +2888,7 @@ namespace Microsoft.PowerShell base(info, context) { } -#endif + internal ConsoleHostStartupException(string message, Exception innerException) : @@ -2931,23 +2919,7 @@ namespace Microsoft.PowerShell private bool _isDisposed; internal ConsoleHostUserInterface ui; -#if CORECLR internal Lazy ConsoleIn { get; } = new Lazy(() => Console.In); -#else - internal Lazy ConsoleIn { get; } = new Lazy(() => - { - // This is a workaround for a full clr issue that causes a hang when calling PowerShell from ruby. - // They use named pipes instead of anonymous pipes, and for some reason that triggers a hang - // reading from Console.In. - var inputHandle = ConsoleControl.NativeMethods.GetStdHandle(-10); - var s = new FileStream(new ConsoleHandle(inputHandle, false), FileAccess.Read); - - uint codePage = (uint) ConsoleControl.NativeMethods.GetConsoleCP(); - Encoding encoding = Encoding.GetEncoding((int) codePage); - - return TextReader.Synchronized(new StreamReader(s, encoding, false)); - }); -#endif private string _savedWindowTitle = ""; private Version _ver = PSVersionInfo.PSVersion; diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleShell.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleShell.cs index c5e0d332c0..801b3dbed5 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleShell.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleShell.cs @@ -15,7 +15,6 @@ namespace Microsoft.PowerShell public static class ConsoleShell { -#if CORECLR /// Entry point in to ConsoleShell. This method is called by main of minishell. /// Banner text to be displayed by ConsoleHost /// Help text for minishell. This is displayed on 'minishell -?'.