From 59ad53181e124cd99744161286a910983ce1c050 Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 21 Feb 2020 00:39:15 +0500 Subject: [PATCH] Remove old dead code from FullCLR (#11886) --- .../security/ExecutionPolicyCommands.cs | 2 -- .../engine/parser/Parser.cs | 4 ---- .../fanin/InitialSessionStateProvider.cs | 3 --- .../remoting/fanin/WSManPluginFacade.cs | 20 ------------------- .../help/UpdatableHelpCommandBase.cs | 6 +----- 5 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs b/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs index 80d125b0f5..21da73e205 100644 --- a/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs @@ -233,10 +233,8 @@ namespace Microsoft.PowerShell.Commands } } -#if !CORECLR PSEtwLog.LogSettingsEvent(MshLog.GetLogContext(Context, MyInvocation), EtwLoggingStrings.ExecutionPolicyName, executionPolicy, null); -#endif } } diff --git a/src/System.Management.Automation/engine/parser/Parser.cs b/src/System.Management.Automation/engine/parser/Parser.cs index b0b84572dd..314680c932 100644 --- a/src/System.Management.Automation/engine/parser/Parser.cs +++ b/src/System.Management.Automation/engine/parser/Parser.cs @@ -8,14 +8,10 @@ using System.Diagnostics.Tracing; using System.Globalization; using System.IO; using System.Linq; -using System.Linq.Expressions; using System.Management.Automation.Runspaces; using System.Reflection; using System.Runtime.CompilerServices; using System.Threading.Tasks; -#if !CORECLR -using Microsoft.CodeAnalysis; -#endif namespace System.Management.Automation.Language { diff --git a/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs b/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs index 27bd8066da..0d25baf5f8 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs @@ -243,9 +243,6 @@ namespace System.Management.Automation.Remoting readerSettings.IgnoreProcessingInstructions = true; readerSettings.MaxCharactersInDocument = 10000; readerSettings.ConformanceLevel = ConformanceLevel.Fragment; -#if !CORECLR // No XmlReaderSettings.XmlResolver in CoreCLR - readerSettings.XmlResolver = null; -#endif using (XmlReader reader = XmlReader.Create(new StringReader(initializationParameters), readerSettings)) { diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManPluginFacade.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManPluginFacade.cs index 3700da98e8..c318cfb2b5 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManPluginFacade.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManPluginFacade.cs @@ -435,27 +435,7 @@ namespace System.Management.Automation.Remoting { return WSManPluginConstants.ExitCodeFailure; } -#if !CORECLR - // For long-path support, Full .NET requires some AppContext switches; - // (for CoreCLR this is Not needed, because CoreCLR supports long paths by default) - // internally in .NET they are cached once retrieved and are typically hit very early during an application run; - // so per .NET team's recommendation, we are setting them as soon as we enter managed code. - // We build against CLR4.5 so we can run on Win7/Win8, but we want to use apis added to CLR 4.6, so we use reflection - try - { - Type appContextType = Type.GetType("System.AppContext"); // type is in mscorlib, so it is sufficient to supply the type name qualified by its namespace - object[] blockLongPathsSwitch = new object[] { "Switch.System.IO.BlockLongPaths", false }; - object[] useLegacyPathHandlingSwitch = new object[] { "Switch.System.IO.UseLegacyPathHandling", false }; - - appContextType.InvokeMember("SetSwitch", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod, null, null, blockLongPathsSwitch, CultureInfo.InvariantCulture); - appContextType.InvokeMember("SetSwitch", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod, null, null, useLegacyPathHandlingSwitch, CultureInfo.InvariantCulture); - } - catch (Exception) - { - // If there are any non-critical exceptions (e.g. we are running on CLR prior to 4.6.2), we won't be able to use long paths - } -#endif Marshal.StructureToPtr(workerPtrs.UnmanagedStruct, wkrPtrs, false); return WSManPluginConstants.ExitCodeSuccess; } diff --git a/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs b/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs index ad6a1af315..6de0821388 100644 --- a/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs +++ b/src/System.Management.Automation/help/UpdatableHelpCommandBase.cs @@ -823,12 +823,8 @@ namespace Microsoft.PowerShell.Commands /// Message to log. internal void LogMessage(string message) { -#if !CORECLR // TODO:CORECLR Uncomment when we add PSEtwLog support - List details = new List(); - - details.Add(message); + List details = new List() { message }; PSEtwLog.LogPipelineExecutionDetailEvent(MshLog.GetLogContext(Context, Context.CurrentCommandProcessor.Command.MyInvocation), details); -#endif } #endregion