mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Remove old dead code from FullCLR (#11886)
This commit is contained in:
@@ -233,10 +233,8 @@ namespace Microsoft.PowerShell.Commands
|
||||
}
|
||||
}
|
||||
|
||||
#if !CORECLR
|
||||
PSEtwLog.LogSettingsEvent(MshLog.GetLogContext(Context, MyInvocation),
|
||||
EtwLoggingStrings.ExecutionPolicyName, executionPolicy, null);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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<WSManPluginEntryDelegates.WSManPluginEntryDelegatesInternal>(workerPtrs.UnmanagedStruct, wkrPtrs, false);
|
||||
return WSManPluginConstants.ExitCodeSuccess;
|
||||
}
|
||||
|
||||
@@ -823,12 +823,8 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// <param name="message">Message to log.</param>
|
||||
internal void LogMessage(string message)
|
||||
{
|
||||
#if !CORECLR // TODO:CORECLR Uncomment when we add PSEtwLog support
|
||||
List<string> details = new List<string>();
|
||||
|
||||
details.Add(message);
|
||||
List<string> details = new List<string>() { message };
|
||||
PSEtwLog.LogPipelineExecutionDetailEvent(MshLog.GetLogContext(Context, Context.CurrentCommandProcessor.Command.MyInvocation), details);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user