From 4dfc0b0cfff5420de92db2ea5bd2280e47f54ae2 Mon Sep 17 00:00:00 2001 From: Vijaya Krishna Pondala Date: Wed, 3 Oct 2018 22:10:36 +1000 Subject: [PATCH 1/4] Remove unused commented-out code (#2171) --- .../CimWriteError.cs | 2 - .../GetCimAssociatedInstanceCommand.cs | 29 ----------- .../CommonUtils.cs | 1 - .../management/TestConnectionCommand.cs | 2 - src/Microsoft.WSMan.Management/CredSSP.cs | 49 ------------------- .../engine/hostifaces/LocalPipeline.cs | 7 --- 6 files changed, 90 deletions(-) diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs index 72ad2505645..90d893e6910 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs @@ -183,8 +183,6 @@ internal static ErrorRecord InitializeErrorRecordCore( originInfo); DebugHelper.WriteLogEx("Created RemotingErrorRecord.", 0); - // errorRecord.SetInvocationInfo(jobContext.CmdletInvocationInfo); - // errorRecord.PreserveInvocationInfoOnce = true; return errorRecord; } diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimAssociatedInstanceCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimAssociatedInstanceCommand.cs index 9f05857fe6d..babb12d0403 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimAssociatedInstanceCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimAssociatedInstanceCommand.cs @@ -72,31 +72,6 @@ public String ResultClassName } private String resultClassName; - /// - /// The following is the definition of the input parameter "AssociatorRole". - /// Specifies the name of the association role of the instances to be retrieved. - /// - //[Parameter(ValueFromPipelineByPropertyName = true)] - //public String AssociatorRole - //{ - // get { return associatorRole; } - // set { associatorRole = value; } - //} - //private String associatorRole; - - /// - /// The following is the definition of the input parameter "SourceRole". - /// Specifies the name of the association role of the source instance where the - /// association traversal should begin. - /// - //[Parameter(ValueFromPipelineByPropertyName = true)] - //public String SourceRole - //{ - // get { return sourcerole; } - // set { sourcerole = value; } - //} - //private String sourcerole; - /// /// /// The following is the definition of the input parameter "InputObject". @@ -315,14 +290,10 @@ CimGetAssociatedInstance CreateOperationAgent() #region private members #region const string of parameter names - // internal const string nameAssociation = "Association"; internal const string nameCimInstance = "InputObject"; - // internal const string nameNamespace = "Namespace"; - // internal const string nameOperationTimeoutSec = "OperationTimeoutSec"; internal const string nameComputerName = "ComputerName"; internal const string nameCimSession = "CimSession"; internal const string nameResourceUri = "ResourceUri"; - // internal const string nameKeyOnly = "KeyOnly"; #endregion /// diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs index c128e39bcf8..205b13fd191 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/CommonUtils.cs @@ -129,7 +129,6 @@ public static uint FormatMessageFromModule(uint lastError, string moduleName, ou if (nChars == 0) { formatError = (uint)Marshal.GetLastWin32Error(); - //Console.WriteLine("Win32FormatMessage", String.Format(null, "Error formatting message: {0}", formatError)); } else { diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs index 279a8f9f0bd..45421411968 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestConnectionCommand.cs @@ -27,9 +27,7 @@ public class TestConnectionCommand : PSCmdlet private const string ParameterSetPingCount = "PingCount"; private const string ParameterSetPingContinues = "PingContinues"; private const string ParameterSetTraceRoute = "TraceRoute"; - //private const string ParameterSetPathPing = "PathPing"; private const string ParameterSetConnectionByTCPPort = "ConnectionByTCPPort"; - //private const string ParameterSetDetectionOfBlackHole = "DetectionOfBlackHole"; private const string ParameterSetDetectionOfMTUSize = "DetectionOfMTUSize"; #region Parameters diff --git a/src/Microsoft.WSMan.Management/CredSSP.cs b/src/Microsoft.WSMan.Management/CredSSP.cs index fc5fcc38799..b3e6b40edf4 100644 --- a/src/Microsoft.WSMan.Management/CredSSP.cs +++ b/src/Microsoft.WSMan.Management/CredSSP.cs @@ -402,14 +402,6 @@ protected override void BeginProcessing() [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SSP")] public class EnableWSManCredSSPCommand : WSManCredSSPCommandBase, IDisposable/*, IDynamicParameters*/ { - #region Private Data - - //private const string DelegateComputerParam = "DelegateComputer"; - //private String[] delegatecomputer; - //private RuntimeDefinedParameterDictionary dynamicParameters = new RuntimeDefinedParameterDictionary(); - - #endregion - /// /// delegate parameter /// @@ -494,42 +486,6 @@ protected override void BeginProcessing() } }//End BeginProcessing() - /* - /// - /// This method returns DynamicParameters used for Enable-WSManCredSSP cmdlet. Enable-WSManCredSSP - /// supports -DelegateComputer parameter when -Role is client. - /// - /// - /// An object representing the dynamic parameters for the cmdlet or null if there - /// are none. - /// - object IDynamicParameters.GetDynamicParameters() - { - // return null if the role is not client. - if (!Role.Equals(ClientRole, StringComparison.OrdinalIgnoreCase)) - { - return dynamicParameters; - } - - // Construct attributes for the DelegateComputer parameter - Collection delegateComputerAttributeCollection = new Collection(); - ParameterAttribute paramAttribute = new ParameterAttribute(); - paramAttribute.Mandatory = true; - paramAttribute.Position = 1; - ValidateNotNullOrEmptyAttribute notNullAttribute = new ValidateNotNullOrEmptyAttribute(); - delegateComputerAttributeCollection.Add(paramAttribute); - delegateComputerAttributeCollection.Add(notNullAttribute); - - // Construct the parameter and return. - RuntimeDefinedParameter delegateComputer = new RuntimeDefinedParameter( - DelegateComputerParam, - typeof(string[]), - delegateComputerAttributeCollection); - dynamicParameters.Add(DelegateComputerParam, delegateComputer); - - return dynamicParameters; - - } // GetDynamicParameters*/ #endregion @@ -565,9 +521,6 @@ private void EnableClientSideSettings() WriteError(er); return; } - // Extract delegateComputer information from dynamic parameters collection - //RuntimeDefinedParameter delegateComputerParameter = dynamicParameters[DelegateComputerParam]; - //delegatecomputer = (string[])delegateComputerParameter.Value; string newxmlcontent = @"true"; try @@ -776,7 +729,6 @@ private void UpdateGPORegistrySettings(string applicationname, string[] delegate void Dispose() { - //CleanUp(); GC.SuppressFinalize(this); } /// @@ -985,7 +937,6 @@ protected override void BeginProcessing() void Dispose() { - //CleanUp(); GC.SuppressFinalize(this); } /// diff --git a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs index a740680b397..3abf7cbf8fc 100644 --- a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs +++ b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs @@ -420,13 +420,6 @@ private FlowControlException InvokeHelper() finally { this.LocalRunspace.ExecutionContext.EngineHostInterface.SetShouldExit(exitCode); - - // close the remote runspaces available - /*foreach (RemoteRunspaceInfo remoteRunspaceInfo in - this.LocalRunspace.RunspaceRepository.Runspaces) - { - remoteRunspaceInfo.RemoteRunspace.CloseAsync(); - }*/ } } } From ad5566cd048ab19c7285322d9beb9ca188b74b1a Mon Sep 17 00:00:00 2001 From: Vijaya Krishna Pondala Date: Wed, 3 Oct 2018 22:11:17 +1000 Subject: [PATCH 2/4] Removed extra ; (unreachable code) from case statements (#2171) --- .../cmdletization/cim/CimJobException.cs | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/CimJobException.cs b/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/CimJobException.cs index af44bb8fee8..4493c263a06 100644 --- a/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/CimJobException.cs +++ b/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/CimJobException.cs @@ -267,57 +267,57 @@ private static ErrorCategory ConvertCimNativeErrorCodeToErrorCategory(NativeErro case NativeErrorCode.Ok: return ErrorCategory.NotSpecified; case NativeErrorCode.Failed: - return ErrorCategory.NotSpecified; ; + return ErrorCategory.NotSpecified; case NativeErrorCode.AccessDenied: - return ErrorCategory.PermissionDenied; ; + return ErrorCategory.PermissionDenied; case NativeErrorCode.InvalidNamespace: - return ErrorCategory.MetadataError; ; + return ErrorCategory.MetadataError; case NativeErrorCode.InvalidParameter: - return ErrorCategory.InvalidArgument; ; + return ErrorCategory.InvalidArgument; case NativeErrorCode.InvalidClass: - return ErrorCategory.MetadataError; ; + return ErrorCategory.MetadataError; case NativeErrorCode.NotFound: - return ErrorCategory.ObjectNotFound; ; + return ErrorCategory.ObjectNotFound; case NativeErrorCode.NotSupported: - return ErrorCategory.NotImplemented; ; + return ErrorCategory.NotImplemented; case NativeErrorCode.ClassHasChildren: - return ErrorCategory.MetadataError; ; + return ErrorCategory.MetadataError; case NativeErrorCode.ClassHasInstances: - return ErrorCategory.MetadataError; ; + return ErrorCategory.MetadataError; case NativeErrorCode.InvalidSuperClass: - return ErrorCategory.MetadataError; ; + return ErrorCategory.MetadataError; case NativeErrorCode.AlreadyExists: - return ErrorCategory.ResourceExists; ; + return ErrorCategory.ResourceExists; case NativeErrorCode.NoSuchProperty: - return ErrorCategory.MetadataError; ; + return ErrorCategory.MetadataError; case NativeErrorCode.TypeMismatch: - return ErrorCategory.InvalidType; ; + return ErrorCategory.InvalidType; case NativeErrorCode.QueryLanguageNotSupported: - return ErrorCategory.NotImplemented; ; + return ErrorCategory.NotImplemented; case NativeErrorCode.InvalidQuery: - return ErrorCategory.InvalidArgument; ; + return ErrorCategory.InvalidArgument; case NativeErrorCode.MethodNotAvailable: - return ErrorCategory.MetadataError; ; + return ErrorCategory.MetadataError; case NativeErrorCode.MethodNotFound: - return ErrorCategory.MetadataError; ; + return ErrorCategory.MetadataError; case NativeErrorCode.NamespaceNotEmpty: - return ErrorCategory.MetadataError; ; + return ErrorCategory.MetadataError; case NativeErrorCode.InvalidEnumerationContext: - return ErrorCategory.MetadataError; ; + return ErrorCategory.MetadataError; case NativeErrorCode.InvalidOperationTimeout: - return ErrorCategory.InvalidArgument; ; + return ErrorCategory.InvalidArgument; case NativeErrorCode.PullHasBeenAbandoned: - return ErrorCategory.OperationStopped; ; + return ErrorCategory.OperationStopped; case NativeErrorCode.PullCannotBeAbandoned: - return ErrorCategory.CloseError; ; + return ErrorCategory.CloseError; case NativeErrorCode.FilteredEnumerationNotSupported: - return ErrorCategory.NotImplemented; ; + return ErrorCategory.NotImplemented; case NativeErrorCode.ContinuationOnErrorNotSupported: - return ErrorCategory.NotImplemented; ; + return ErrorCategory.NotImplemented; case NativeErrorCode.ServerLimitsExceeded: - return ErrorCategory.ResourceBusy; ; + return ErrorCategory.ResourceBusy; case NativeErrorCode.ServerIsShuttingDown: - return ErrorCategory.ResourceUnavailable; ; + return ErrorCategory.ResourceUnavailable; default: return ErrorCategory.NotSpecified; } From aca507faf24e79a74899a9b49278a499c8a8f0f9 Mon Sep 17 00:00:00 2001 From: Vijaya Krishna Pondala Date: Wed, 3 Oct 2018 22:12:39 +1000 Subject: [PATCH 3/4] Fixed typo in InputObject doc string (#2171) --- .../commands/utility/FormatAndOutput/format-hex/Format-Hex.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/format-hex/Format-Hex.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/format-hex/Format-Hex.cs index 5105c6280b2..3f48a9bd119 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/format-hex/Format-Hex.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/format-hex/Format-Hex.cs @@ -40,7 +40,7 @@ public sealed class FormatHex : PSCmdlet public string[] LiteralPath { get; set; } /// - /// Ojbect to process. + /// Object to process. /// [Parameter(Mandatory = true, ParameterSetName = "ByInputObject", ValueFromPipeline = true)] public PSObject InputObject { get; set; } From 4af4f1162f6e5dfbf89c038d3018c1d18a7fe2e5 Mon Sep 17 00:00:00 2001 From: Vijaya Krishna Pondala Date: Wed, 3 Oct 2018 22:12:54 +1000 Subject: [PATCH 4/4] Remove unused commented-out code (#2171) --- .../commands/management/GetComputerInfoCommand.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs index 8fefb0334b2..b2e8767fb46 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs @@ -5167,14 +5167,6 @@ private static class PInvokeDllNames /// An hresult indicating success or failure. [DllImport("slc.dll", CharSet = CharSet.Unicode)] internal static extern int SLGetWindowsInformationDWORD(string licenseProperty, out int propertyValue); - /* - * SLGetWindowsInformationDWORD function returns - * S_OK (0x00000000): If the method succeeds - * SL_E_RIGHT_NOT_GRANTED (0xC004F013): The caller does not have the permissions necessary to call this function. - * SL_E_DATATYPE_MISMATCHED (0xC004F013): The value portion of the name-value pair is not a DWORD. - [DllImport("Slc.dll", EntryPoint = "SLGetWindowsInformationDWORD", CharSet = CharSet.Unicode)] - public static extern UInt32 SLGetWindowsInformationDWORD(string pwszValueName, ref int pdwValue); - */ } #endregion Native }