From 233b54ed65d398604c0bfadccdc59cb81eb7e5de Mon Sep 17 00:00:00 2001 From: Ilya Date: Sun, 6 Jan 2019 06:51:20 +0500 Subject: [PATCH] Style: Add a space after "//" in comments and remove unneeded comments after "}" (#8576) --- .../CimAsyncOperation.cs | 4 +- .../CimBaseAction.cs | 6 +- .../CimCmdletModuleInitialize.cs | 4 +- .../CimCommandBase.cs | 6 +- .../CimGetAssociatedInstance.cs | 4 +- .../CimGetCimClass.cs | 4 +- .../CimGetInstance.cs | 4 +- .../CimIndicationWatcher.cs | 2 +- .../CimInvokeCimMethod.cs | 4 +- .../CimNewCimInstance.cs | 6 +- .../CimPromptUser.cs | 4 +- .../CimRegisterCimIndication.cs | 4 +- .../CimRemoveCimInstance.cs | 4 +- .../CimSessionOperations.cs | 12 +- .../CimSessionProxy.cs | 4 +- .../CimSetCimInstance.cs | 4 +- .../CimWriteError.cs | 4 +- .../CimWriteMessage.cs | 4 +- .../CimWriteProgress.cs | 4 +- .../CimWriteResultObject.cs | 4 +- .../CmdletOperation.cs | 12 +- .../GetCimAssociatedInstanceCommand.cs | 10 +- .../GetCimClassCommand.cs | 10 +- .../GetCimInstanceCommand.cs | 10 +- .../GetCimSessionCommand.cs | 8 +- .../InvokeCimMethodCommand.cs | 10 +- .../NewCimInstanceCommand.cs | 10 +- .../NewCimSessionCommand.cs | 10 +- .../NewCimSessionOptionCommand.cs | 10 +- .../RegisterCimIndicationCommand.cs | 6 +- .../RemoveCimInstanceCommand.cs | 10 +- .../RemoveCimSessionCommand.cs | 8 +- .../SetCimInstanceCommand.cs | 10 +- .../Utils.cs | 12 +- .../GetCounterCommand.cs | 10 +- .../GetEventCommand.cs | 2 +- .../ImportCounterCommand.cs | 2 +- .../PdhHelper.cs | 70 +- .../commands/management/Computer.cs | 20 +- .../commands/management/Eventlog.cs | 26 +- .../management/GetComputerInfoCommand.cs | 44 +- .../commands/management/Hotfix.cs | 24 +- .../management/InvokeWMIMethodCommand.cs | 10 +- .../commands/management/Process.cs | 2 +- .../management/RegisterWMIEventCommand.cs | 2 +- .../management/RemoveWMIObjectCommand.cs | 4 +- .../commands/management/Service.cs | 16 +- .../management/SetClipboardCommand.cs | 10 +- .../commands/management/SetContentCommand.cs | 2 +- .../management/SetWMIInstanceCommand.cs | 4 +- .../commands/management/TimeZoneCommands.cs | 2 +- .../commands/management/WMIHelper.cs | 86 +- .../commands/management/WebServiceProxy.cs | 36 +- .../commands/utility/CSVCommands.cs | 126 +-- .../commands/utility/Csv.cs | 4 +- .../commands/utility/CustomSerialization.cs | 68 +- .../common/GetFormatDataCommand.cs | 2 +- .../out-printer/PrinterLineOutput.cs | 2 +- .../FormatAndOutput/out-string/out-string.cs | 2 +- .../commands/utility/GetAliasCommand.cs | 4 +- .../commands/utility/GetDateCommand.cs | 20 +- .../commands/utility/GetMember.cs | 2 +- .../commands/utility/ObjectCommandComparer.cs | 2 +- .../commands/utility/SetDateCommand.cs | 2 +- .../commands/utility/StartSleepCommand.cs | 8 +- .../Common/InvokeRestMethodCommand.Common.cs | 2 +- .../Common/WebRequestPSCmdlet.Common.cs | 2 +- .../commands/utility/XmlCommands.cs | 18 +- .../commands/utility/convert-HTML.cs | 32 +- .../commands/utility/new-object.cs | 4 +- .../commands/utility/select-object.cs | 8 +- .../utility/trace/TraceListenerCommandBase.cs | 2 +- .../commands/utility/update-list.cs | 8 +- .../host/msh/ConsoleControl.cs | 12 +- .../host/msh/ConsoleHost.cs | 4 +- .../host/msh/ConsoleHostRawUserInterface.cs | 18 +- .../host/msh/ConsoleHostUserInterface.cs | 18 +- .../host/msh/Executor.cs | 18 +- .../host/msh/ProgressPane.cs | 6 +- .../host/msh/StartTranscriptCmdlet.cs | 2 +- .../DotNetCode/Eventing/EventProvider.cs | 8 +- .../Eventing/Reader/EventKeyword.cs | 4 +- .../DotNetCode/Eventing/Reader/EventLevel.cs | 4 +- .../Eventing/Reader/EventLogReader.cs | 16 +- .../Eventing/Reader/EventLogRecord.cs | 10 +- .../Eventing/Reader/EventLogSession.cs | 28 +- .../Eventing/Reader/EventMetadata.cs | 12 +- .../DotNetCode/Eventing/Reader/EventOpcode.cs | 8 +- .../DotNetCode/Eventing/Reader/EventTask.cs | 4 +- .../Eventing/Reader/NativeWrapper.cs | 24 +- .../Eventing/Reader/ProviderMetadata.cs | 6 +- .../ProviderMetadataCachedInformation.cs | 8 +- .../Eventing/UnsafeNativeMethods.cs | 46 +- .../Commands/AddLocalGroupMemberCommand.cs | 4 +- .../Commands/DisableLocalUserCommand.cs | 4 +- .../Commands/EnableLocalUserCommand.cs | 4 +- .../Commands/GetLocalGroupCommand.cs | 4 +- .../Commands/GetLocalGroupMemberCommand.cs | 8 +- .../Commands/GetLocalUserCommand.cs | 4 +- .../Commands/NewLocalGroupCommand.cs | 4 +- .../Commands/NewLocalUserCommand.cs | 4 +- .../Commands/RemoveLocalGroupCommand.cs | 4 +- .../Commands/RemoveLocalGroupMemberCommand.cs | 4 +- .../Commands/RemoveLocalUserCommand.cs | 4 +- .../Commands/RenameLocalGroupCommand.cs | 4 +- .../Commands/RenameLocalUserCommand.cs | 4 +- .../Commands/SetLocalGroupCommand.cs | 4 +- .../Commands/SetLocalUserCommand.cs | 4 +- .../LocalAccounts/Sam.cs | 12 +- .../LocalAccounts/SamApi.cs | 2 +- .../ScheduledJob.cs | 2 +- .../security/AclCommands.cs | 24 +- .../security/CertificateProvider.cs | 132 +-- .../security/ExecutionPolicyCommands.cs | 12 +- .../security/SignatureCommands.cs | 2 +- .../ConfigProvider.cs | 242 ++-- src/Microsoft.WSMan.Management/CredSSP.cs | 32 +- .../InvokeWSManAction.cs | 12 +- .../NewWSManSession.cs | 8 +- src/Microsoft.WSMan.Management/PingWSMan.cs | 8 +- .../Set-QuickConfig.cs | 10 +- .../WSManConnections.cs | 12 +- .../WSManInstance.cs | 32 +- src/Microsoft.WSMan.Management/WsManHelper.cs | 54 +- .../CoreCLR/CorePsAssemblyLoadContext.cs | 14 +- .../CoreCLR/CorePsPlatform.cs | 34 +- .../DscSupport/CimDSCParser.cs | 20 +- .../common/BaseOutputtingCommand.cs | 10 +- .../FormatAndOutput/common/ComplexWriter.cs | 2 +- .../common/DisplayDatabase/XmlLoaderBase.cs | 26 +- .../DisplayDatabase/displayDescriptionData.cs | 4 +- .../DisplayDatabase/typeDataXmlLoader.cs | 66 +- .../typeDataXmlLoader_Complex.cs | 38 +- .../DisplayDatabase/typeDataXmlLoader_List.cs | 20 +- .../typeDataXmlLoader_Table.cs | 28 +- .../typeDataXmlLoader_Views.cs | 18 +- .../DisplayDatabase/typeDataXmlLoader_Wide.cs | 18 +- .../common/FormatMsgCtxManager.cs | 2 +- .../common/FormatViewGenerator_Table.cs | 2 +- .../common/FormatViewGenerator_Wide.cs | 4 +- .../common/FormatViewManager.cs | 2 +- .../common/FormattingObjectsDeserializer.cs | 2 +- .../Utilities/MshParameterAssociation.cs | 2 +- .../out-console/ConsoleLineOutput.cs | 20 +- .../cimSupport/cmdletization/ScriptWriter.cs | 12 +- .../other/ciminstancetypeadapter.cs | 4 +- .../engine/ArgumentTypeConverterAttribute.cs | 10 +- .../engine/Attributes.cs | 2 +- .../engine/COM/ComMethod.cs | 2 +- .../engine/COM/ComTypeInfo.cs | 20 +- .../engine/COM/ComUtil.cs | 18 +- .../engine/ComInterop/BoolArgBuilder.cs | 2 +- .../engine/ComInterop/ComBinderHelpers.cs | 2 +- .../engine/ComInterop/ComEventSink.cs | 2 +- .../engine/ComInterop/ComEventSinkProxy.cs | 2 +- .../engine/ComInterop/ComMethodDesc.cs | 4 +- .../engine/ComInterop/ComParamDesc.cs | 2 +- .../engine/ComInterop/ComRuntimeHelpers.cs | 4 +- .../engine/ComInterop/ComTypeDesc.cs | 4 +- .../engine/ComInterop/ConversionArgBuilder.cs | 2 +- .../ComInterop/ConvertibleArgBuilder.cs | 2 +- .../engine/ComInterop/IDispatchComObject.cs | 6 +- .../engine/ComInterop/TypeUtils.cs | 22 +- .../engine/ComInterop/VarEnumSelector.cs | 20 +- .../engine/ComInterop/VariantBuilder.cs | 6 +- .../CommandCompletion/CompletionAnalysis.cs | 2 +- .../CommandCompletion/CompletionCompleters.cs | 12 +- .../PseudoParameterBinder.cs | 2 +- .../engine/CommandDiscovery.cs | 6 +- .../engine/CommandInfo.cs | 6 +- .../engine/CoreAdapter.cs | 2 +- .../engine/Credential.cs | 6 +- .../engine/EnumExpressionEvaluator.cs | 4 +- .../engine/ErrorPackage.cs | 18 +- .../engine/EventManager.cs | 2 +- .../engine/ExecutionContext.cs | 4 +- .../engine/InitialSessionState.cs | 26 +- .../engine/ManagementObjectAdapter.cs | 2 +- .../MinishellParameterBinderController.cs | 6 +- .../engine/Modules/GetModuleCommand.cs | 2 +- .../engine/Modules/ImportModuleCommand.cs | 2 +- .../engine/Modules/ModuleCmdletBase.cs | 10 +- .../engine/Modules/ModuleUtils.cs | 2 +- .../Modules/NewModuleManifestCommand.cs | 6 +- .../engine/Modules/PSModuleInfo.cs | 4 +- .../Modules/TestModuleManifestCommand.cs | 6 +- .../engine/MshCommandRuntime.cs | 4 +- .../engine/MshObject.cs | 10 +- .../engine/NativeCommandProcessor.cs | 54 +- .../engine/PSClassSearcher.cs | 2 +- .../engine/ParameterBinderBase.cs | 6 +- .../engine/ParameterBinderController.cs | 4 +- .../engine/SessionStateProviderAPIs.cs | 4 +- .../engine/SessionStateScope.cs | 2 +- .../engine/SessionStateVariableAPIs.cs | 2 +- .../engine/TypeTable.cs | 4 +- .../engine/Utils.cs | 8 +- .../engine/hostifaces/AsyncResult.cs | 2 +- .../engine/hostifaces/Command.cs | 6 +- .../engine/hostifaces/Connection.cs | 2 +- .../engine/hostifaces/ConnectionBase.cs | 102 +- .../engine/hostifaces/History.cs | 136 +-- .../InternalHostRawUserInterface.cs | 4 +- .../hostifaces/InternalHostUserInterface.cs | 20 +- .../engine/hostifaces/LocalConnection.cs | 68 +- .../engine/hostifaces/LocalPipeline.cs | 108 +- .../hostifaces/NativeCultureResolver.cs | 4 +- .../engine/hostifaces/Parameter.cs | 2 +- .../engine/hostifaces/PowerShell.cs | 4 +- .../engine/hostifaces/RunspacePoolInternal.cs | 8 +- .../internalHostuserInterfacesecurity.cs | 4 +- .../engine/hostifaces/pipelinebase.cs | 126 +-- .../engine/interpreter/BranchLabel.cs | 2 +- .../interpreter/ControlFlowInstructions.cs | 2 +- .../engine/interpreter/InterpretedFrame.cs | 2 +- .../engine/interpreter/LightCompiler.cs | 30 +- .../interpreter/LightDelegateCreator.cs | 14 +- .../engine/interpreter/LightLambda.cs | 8 +- .../engine/interpreter/LocalAccess.cs | 4 +- .../engine/interpreter/LocalVariables.cs | 4 +- .../engine/interpreter/Utilities.cs | 14 +- .../engine/parser/Parser.cs | 1000 ++++++++--------- .../engine/parser/SemanticChecks.cs | 6 +- .../engine/parser/ast.cs | 4 +- .../engine/parser/tokenizer.cs | 48 +- .../remoting/client/ClientRemotePowerShell.cs | 6 +- .../engine/remoting/client/Job.cs | 96 +- .../engine/remoting/client/Job2.cs | 10 +- .../client/RemoteRunspacePoolInternal.cs | 2 +- .../remoting/client/RemotingProtocol2.cs | 16 +- .../remoting/client/clientremotesession.cs | 14 +- ...clientremotesessionprotocolstatemachine.cs | 20 +- .../engine/remoting/client/remotepipeline.cs | 62 +- .../engine/remoting/client/remoterunspace.cs | 62 +- .../remoting/client/remotingprotocol.cs | 2 +- .../client/remotingprotocolimplementation.cs | 36 +- .../remoting/commands/CustomShellCommands.cs | 10 +- .../remoting/commands/PSRemotingCmdlet.cs | 20 +- .../engine/remoting/commands/ReceiveJob.cs | 24 +- .../engine/remoting/commands/RemoveJob.cs | 12 +- .../engine/remoting/commands/ResumeJob.cs | 2 +- .../engine/remoting/commands/StopJob.cs | 2 +- .../engine/remoting/commands/SuspendJob.cs | 2 +- .../engine/remoting/commands/WaitJob.cs | 2 +- .../remoting/commands/remotingcommandutil.cs | 2 +- .../remoting/common/RunspaceConnectionInfo.cs | 8 +- .../common/WireDataFormat/EncodeAndDecode.cs | 22 +- .../WireDataFormat/RemoteSessionCapability.cs | 2 +- .../engine/remoting/common/misc.cs | 2 +- .../remoting/fanin/BaseTransportManager.cs | 2 +- .../fanin/InitialSessionStateProvider.cs | 2 +- .../fanin/OutOfProcTransportManager.cs | 12 +- .../remoting/fanin/PriorityCollection.cs | 6 +- .../engine/remoting/fanin/WSManNativeAPI.cs | 10 +- .../engine/remoting/fanin/WSManPlugin.cs | 26 +- .../remoting/fanin/WSManPluginShellSession.cs | 16 +- .../fanin/WSManPluginTransportManager.cs | 4 +- .../remoting/fanin/WSManTransportManager.cs | 42 +- .../remoting/server/ServerPowerShellDriver.cs | 8 +- .../server/ServerRemotingProtocol2.cs | 4 +- .../server/ServerSteppablePipelineDriver.cs | 4 +- .../remoting/server/serverremotesession.cs | 44 +- .../server/serverremotesessionstatemachine.cs | 20 +- .../engine/runtime/CompiledScriptBlock.cs | 8 +- .../engine/runtime/MutableTuple.cs | 12 +- .../engine/runtime/Operations/MiscOps.cs | 4 +- .../engine/serialization.cs | 160 +-- .../help/CabinetNativeApi.cs | 2 +- .../help/DscResourceHelpProvider.cs | 2 +- .../help/HelpCommentsParser.cs | 4 +- .../help/HelpFileHelpProvider.cs | 22 +- .../help/HelpUtils.cs | 6 +- .../help/MUIFileSearcher.cs | 4 +- .../help/MamlNode.cs | 4 +- .../help/MamlUtil.cs | 2 +- .../help/PSClassHelpProvider.cs | 4 +- .../logging/MshLog.cs | 14 +- .../namespaces/FileSystemContentStream.cs | 4 +- .../namespaces/FileSystemProvider.cs | 116 +- .../namespaces/RegistryProvider.cs | 4 +- .../namespaces/RegistrySecurity.cs | 4 +- .../namespaces/TransactedRegistry.cs | 2 +- .../namespaces/TransactedRegistryKey.cs | 30 +- .../security/Authenticode.cs | 4 +- .../security/CatalogHelper.cs | 6 +- .../security/MshSignature.cs | 2 +- .../security/SecurityManager.cs | 2 +- .../security/nativeMethods.cs | 16 +- .../singleshell/config/MshSnapinInfo.cs | 22 +- .../utils/CryptoUtils.cs | 20 +- .../utils/PSTelemetryWrapper.cs | 2 +- .../utils/PlatformInvokes.cs | 18 +- .../utils/PowerShellETWTracer.cs | 8 +- .../utils/PowerShellExecutionHelper.cs | 2 +- .../utils/PsUtils.cs | 14 +- .../utils/Verbs.cs | 18 +- 296 files changed, 2729 insertions(+), 2727 deletions(-) diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimAsyncOperation.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimAsyncOperation.cs index 72bd7c150b..1db9132ed1 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimAsyncOperation.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimAsyncOperation.cs @@ -595,5 +595,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets internal const string CimSessionArgument = @"CimSession"; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimBaseAction.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimBaseAction.cs index d20aece5db..c223a72c88 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimBaseAction.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimBaseAction.cs @@ -58,7 +58,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets } private XOperationContextBase context; - }//End Class + } /// /// @@ -197,5 +197,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets } } #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCmdletModuleInitialize.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCmdletModuleInitialize.cs index 06f826244c..7f9a1da405 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCmdletModuleInitialize.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCmdletModuleInitialize.cs @@ -114,5 +114,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets new CimCmdletAliasEntry("gcls", "Get-CimClass"), }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs index 57379379f3..7648a8f0d8 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs @@ -596,7 +596,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets protected override void StopProcessing() { Dispose(); - }//End StopProcessing() + } #endregion @@ -1012,5 +1012,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets return credentials; } #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetAssociatedInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetAssociatedInstance.cs index 43df23e0ee..ec8b3eaab4 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetAssociatedInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetAssociatedInstance.cs @@ -137,5 +137,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetCimClass.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetCimClass.cs index c4da57cc66..7e5f2ed960 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetCimClass.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetCimClass.cs @@ -232,5 +232,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs index b391842bf2..8441b9762d 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs @@ -536,5 +536,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// private const string queryWithoutWhere = @"SELECT {0} FROM {1}"; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimIndicationWatcher.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimIndicationWatcher.cs index 365ffe5f0a..04917ae951 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimIndicationWatcher.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimIndicationWatcher.cs @@ -398,4 +398,4 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets #endregion #endregion } -}//End namespace +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs index bd318d412e..b4c1891b7a 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs @@ -470,5 +470,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// private const string actionTemplate = @"Invoke-CimMethod: {0}"; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimNewCimInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimNewCimInstance.cs index 15c38a7aea..dc2e9a41f7 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimNewCimInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimNewCimInstance.cs @@ -86,7 +86,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets case CimBaseCommand.ResourceUriSessionSet: case CimBaseCommand.ResourceUriComputerSet: { - nameSpace = cmdlet.Namespace; //passing null is ok for resourceUri set + nameSpace = cmdlet.Namespace; // passing null is ok for resourceUri set cimInstance = CreateCimInstance("DummyClass", nameSpace, cmdlet.Key, @@ -366,5 +366,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// private const string action = @"New-CimInstance"; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimPromptUser.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimPromptUser.cs index ae992174f2..56951d8d23 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimPromptUser.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimPromptUser.cs @@ -137,5 +137,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets private CimPromptType prompt; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs index 0139db1895..1bbbea635a 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs @@ -376,5 +376,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRemoveCimInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRemoveCimInstance.cs index f89b882900..2979be4d02 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRemoveCimInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimRemoveCimInstance.cs @@ -147,5 +147,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// private const string action = @"Remove-CimInstance"; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs index 3880e33c92..a8a0395b39 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs @@ -980,7 +980,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets } else { - //CimSession will be returned as part of TestConnection + // CimSession will be returned as part of TestConnection this.cimTestSession.TestCimSession(computerName, proxy); } } @@ -1049,7 +1049,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// /// private CimTestSession cimTestSession; - #endregion //private members + #endregion // private members #region IDisposable @@ -1112,7 +1112,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets } } #endregion - }//End Class + } #endregion @@ -1189,7 +1189,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets #region helper methods #endregion - }//End Class + } #endregion @@ -1265,7 +1265,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets } } } - }//End Class + } #endregion @@ -1303,4 +1303,4 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets #endregion -}//End namespace +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs index fc86cf5398..221212bf54 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs @@ -1990,7 +1990,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets #endregion - }//End Class + } #region class CimSessionProxyTestConnection /// @@ -2354,4 +2354,4 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets } #endregion -}//End namespace +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs index 4ee807563f..76daf60ade 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSetCimInstance.cs @@ -316,5 +316,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets /// private const string action = @"Set-CimInstance"; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs index 474542d2f3..8d8dadbf08 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteError.cs @@ -430,5 +430,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets } #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteMessage.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteMessage.cs index 117d8fa3f2..f694d3fbe1 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteMessage.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteMessage.cs @@ -79,5 +79,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets break; } } - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs index b8495ff809..8e6a6f8698 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteProgress.cs @@ -150,5 +150,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets } #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteResultObject.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteResultObject.cs index a25afaacb6..49cc6791a9 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteResultObject.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimWriteResultObject.cs @@ -49,6 +49,6 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets private object result; #endregion - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CmdletOperation.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CmdletOperation.cs index aaff4d97f3..bb58c6a0b8 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CmdletOperation.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CmdletOperation.cs @@ -131,7 +131,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets ValidationHelper.ValidateNoNullArgument(cmdlet, "cmdlet"); this.cmdlet = cmdlet; } - }//End Class + } #region Class CmdletOperationRemoveCimInstance @@ -193,7 +193,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets private const string cimRemoveCimInstanceParameterName = @"cimRemoveCimInstance"; #endregion - }//End Class + } #endregion @@ -273,7 +273,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets private const string theCimSetCimInstanceParameterName = @"theCimSetCimInstance"; #endregion - }//End Class + } #endregion #region Class CmdletOperationInvokeCimMethod @@ -336,7 +336,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets private const string theCimInvokeCimMethodParameterName = @"theCimInvokeCimMethod"; #endregion - }//End Class + } #endregion @@ -397,7 +397,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets private const string theCimNewSessionParameterName = @"theCimNewSession"; #endregion - }//End Class + } #endregion -}//End namespace +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimAssociatedInstanceCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimAssociatedInstanceCommand.cs index 04f985fb62..e48acddcdd 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimAssociatedInstanceCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimAssociatedInstanceCommand.cs @@ -239,7 +239,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { this.CmdletOperation = new CmdletOperationBase(this); this.AtBeginProcess = false; - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -255,7 +255,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets operation.GetCimAssociatedInstance(this); operation.ProcessActions(this.CmdletOperation); - }//End ProcessRecord() + } /// /// EndProcessing method. @@ -265,7 +265,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets CimGetAssociatedInstance operation = this.GetOperationAgent(); if (operation != null) operation.ProcessRemainActions(this.CmdletOperation); - }//End EndProcessing() + } #endregion @@ -353,5 +353,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { CimBaseCommand.ComputerSetName, new ParameterSetEntry(1, true) }, }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimClassCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimClassCommand.cs index 759748f42f..c8f6e7745c 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimClassCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimClassCommand.cs @@ -211,7 +211,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { this.CmdletOperation = new CmdletOperationBase(this); this.AtBeginProcess = false; - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -227,7 +227,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets cimGetCimClass.GetCimClass(this); cimGetCimClass.ProcessActions(this.CmdletOperation); - }//End ProcessRecord() + } /// /// EndProcessing method. @@ -239,7 +239,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { cimGetCimClass.ProcessRemainActions(this.CmdletOperation); } - }//End EndProcessing() + } #endregion @@ -315,5 +315,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { CimBaseCommand.ComputerSetName, new ParameterSetEntry(0, true) }, }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimInstanceCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimInstanceCommand.cs index 4d9add38d2..bbed668b54 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimInstanceCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimInstanceCommand.cs @@ -450,7 +450,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { this.CmdletOperation = new CmdletOperationBase(this); this.AtBeginProcess = false; - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -467,7 +467,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets cimGetInstance.GetCimInstance(this); cimGetInstance.ProcessActions(this.CmdletOperation); - }//End ProcessRecord() + } /// /// EndProcessing method. @@ -479,7 +479,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { cimGetInstance.ProcessRemainActions(this.CmdletOperation); } - }//End EndProcessing() + } #endregion @@ -668,5 +668,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { CimBaseCommand.QuerySessionSet, new ParameterSetEntry(2) } }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimSessionCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimSessionCommand.cs index 00347e97da..80a0ae70d0 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimSessionCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/GetCimSessionCommand.cs @@ -144,7 +144,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { cimGetSession = new CimGetSession(); this.AtBeginProcess = false; - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -153,7 +153,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { base.CheckParameterSet(); cimGetSession.GetCimSession(this); - }//End ProcessRecord() + } #endregion @@ -208,5 +208,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { CimBaseCommand.NameSet, new ParameterSetEntry(1) }, }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/InvokeCimMethodCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/InvokeCimMethodCommand.cs index 75b7a50916..a1e3229b7f 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/InvokeCimMethodCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/InvokeCimMethodCommand.cs @@ -381,7 +381,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets this.CmdletOperation = new CmdletOperationInvokeCimMethod(this, cimInvokeMethod); this.AtBeginProcess = false; - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -393,7 +393,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets CimInvokeCimMethod cimInvokeMethod = this.GetOperationAgent(); cimInvokeMethod.InvokeCimMethod(this); cimInvokeMethod.ProcessActions(this.CmdletOperation); - }//End ProcessRecord() + } /// /// EndProcessing method. @@ -405,7 +405,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { cimInvokeMethod.ProcessRemainActions(this.CmdletOperation); } - }//End EndProcessing() + } #endregion @@ -574,5 +574,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { CimBaseCommand.CimClassSessionSet, new ParameterSetEntry(3) }, }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs index 54ffe097da..695505e403 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs @@ -325,7 +325,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { this.CmdletOperation = new CmdletOperationBase(this); this.AtBeginProcess = false; - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -361,7 +361,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets cimNewCimInstance.NewCimInstance(this); cimNewCimInstance.ProcessActions(this.CmdletOperation); - }//End ProcessRecord() + } /// /// EndProcessing method. @@ -373,7 +373,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { cimNewCimInstance.ProcessRemainActions(this.CmdletOperation); } - }//End EndProcessing() + } #endregion @@ -512,5 +512,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { CimBaseCommand.ResourceUriComputerSet, new ParameterSetEntry(1) }, }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionCommand.cs index 01b1e21ec2..9c10bc940c 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionCommand.cs @@ -216,7 +216,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets cimNewSession = new CimNewSession(); this.CmdletOperation = new CmdletOperationTestCimSession(this, this.cimNewSession); this.AtBeginProcess = false; - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -228,7 +228,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets BuildSessionOptions(out outputOptions, out outputCredential); cimNewSession.NewCimSession(this, outputOptions, outputCredential); cimNewSession.ProcessActions(this.CmdletOperation); - }//End ProcessRecord() + } /// /// EndProcessing method. @@ -236,7 +236,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets protected override void EndProcessing() { cimNewSession.ProcessRemainActions(this.CmdletOperation); - }//End EndProcessing() + } #endregion #region helper methods @@ -373,5 +373,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets } } #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionOptionCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionOptionCommand.cs index 2a0a38d07c..53c9eeea4f 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionOptionCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionOptionCommand.cs @@ -447,7 +447,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { this.CmdletOperation = new CmdletOperationBase(this); this.AtBeginProcess = false; - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -501,14 +501,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets this.WriteObject(options); } - }//End ProcessRecord() + } /// /// EndProcessing method. /// protected override void EndProcessing() { - }//End EndProcessing() + } #endregion @@ -817,5 +817,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { CimBaseCommand.WSManParameterSet, new ParameterSetEntry(0) }, }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/RegisterCimIndicationCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/RegisterCimIndicationCommand.cs index 4e7055dc87..b4a5a9670d 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/RegisterCimIndicationCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/RegisterCimIndicationCommand.cs @@ -258,7 +258,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets DebugHelper.WriteLog("RegisterCimIndicationCommand::EndProcessing subscribe to Unsubscribed event", 4); newSubscriber.Unsubscribed += new PSEventUnsubscribedEventHandler(newSubscriber_Unsubscribed); } - }//End EndProcessing() + } /// /// @@ -365,5 +365,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimInstanceCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimInstanceCommand.cs index df27f84178..35ec639570 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimInstanceCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimInstanceCommand.cs @@ -251,7 +251,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets this.CmdletOperation = new CmdletOperationRemoveCimInstance(this, cimRemoveInstance); this.AtBeginProcess = false; - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -262,7 +262,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets CimRemoveCimInstance cimRemoveInstance = this.GetOperationAgent(); cimRemoveInstance.RemoveCimInstance(this); cimRemoveInstance.ProcessActions(this.CmdletOperation); - }//End ProcessRecord() + } /// /// EndProcessing method. @@ -274,7 +274,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { cimRemoveInstance.ProcessRemainActions(this.CmdletOperation); } - }//End EndProcessing() + } #endregion @@ -379,5 +379,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { CimBaseCommand.QuerySessionSet, new ParameterSetEntry(2) }, }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimSessionCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimSessionCommand.cs index efaefa8b4d..6e95babeca 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimSessionCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/RemoveCimSessionCommand.cs @@ -170,7 +170,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { this.cimRemoveSession = new CimRemoveSession(); this.AtBeginProcess = false; - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -179,7 +179,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { base.CheckParameterSet(); this.cimRemoveSession.RemoveCimSession(this); - }//End ProcessRecord() + } #region private members /// @@ -240,5 +240,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { CimBaseCommand.NameSet, new ParameterSetEntry(1) }, }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/SetCimInstanceCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/SetCimInstanceCommand.cs index 865f29037c..f8e22c8237 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/SetCimInstanceCommand.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/SetCimInstanceCommand.cs @@ -308,7 +308,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets this.CmdletOperation = new CmdletOperationSetCimInstance(this, cimSetCimInstance); this.AtBeginProcess = false; - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -319,7 +319,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets CimSetCimInstance cimSetCimInstance = this.GetOperationAgent(); cimSetCimInstance.SetCimInstance(this); cimSetCimInstance.ProcessActions(this.CmdletOperation); - }//End ProcessRecord() + } /// /// EndProcessing method. @@ -331,7 +331,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { cimSetCimInstance.ProcessRemainActions(this.CmdletOperation); } - }//End EndProcessing() + } #endregion @@ -445,5 +445,5 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { CimBaseCommand.CimInstanceComputerSet, new ParameterSetEntry(1, true) }, }; #endregion - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs index c78a48bde6..6c06ca4d83 100644 --- a/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs +++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/Utils.cs @@ -216,14 +216,14 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets { StackTrace trace = new StackTrace(); StackFrame frame = trace.GetFrame(depth); - //if (withFileName) - //{ + // if (withFileName) + // { // return string.Format(CultureInfo.CurrentUICulture, "{0}#{1}:{2}:", frame.GetFileName()., frame.GetFileLineNumber(), frame.GetMethod().Name); - //} - //else - //{ + // } + // else + // { // return string.Format(CultureInfo.CurrentUICulture, "{0}:", frame.GetMethod()); - //} + // } return string.Format(CultureInfo.CurrentUICulture, "{0}::{1} ", frame.GetMethod().DeclaringType.Name, diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/GetCounterCommand.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/GetCounterCommand.cs index 63d262f4b2..0310271a0d 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/GetCounterCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/GetCounterCommand.cs @@ -325,7 +325,7 @@ namespace Microsoft.PowerShell.Commands uint res = _pdhHelper.EnumObjects(machine, ref counterSets); if (res != 0) { - //add an error message + // add an error message string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("NoCounterSetsOnComputer"), machine, res); Exception exc = new Exception(msg); WriteError(new ErrorRecord(exc, "NoCounterSetsOnComputer", ErrorCategory.InvalidResult, machine)); @@ -407,7 +407,7 @@ namespace Microsoft.PowerShell.Commands { categoryType = PerformanceCounterCategoryType.MultiInstance; } - else //if (counterSetInstances.Count == 1) //??? + else // if (counterSetInstances.Count == 1) //??? { categoryType = PerformanceCounterCategoryType.SingleInstance; } @@ -535,14 +535,14 @@ namespace Microsoft.PowerShell.Commands if (res == 0) { - //Display valid data + // Display valid data if (!bSkip) { WriteSampleSetObject(nextSet); sampleReads++; } - //Don't need to skip anymore + // Don't need to skip anymore bSkip = false; } else if (res == PdhResults.PDH_NO_DATA || res == PdhResults.PDH_INVALID_DATA) @@ -619,7 +619,7 @@ namespace Microsoft.PowerShell.Commands foreach (string path in _accumulatedCounters) { - if (path.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase)) //NOTE: can we do anything smarter here? + if (path.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase)) // NOTE: can we do anything smarter here? { retColl.Add(path); } diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs index 1197ca1122..5109daa0bc 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs @@ -1333,7 +1333,7 @@ namespace Microsoft.PowerShell.Commands result.Append(queryCloser); } - } //end foreach hashtable + } result.Append(queryListClose); diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/ImportCounterCommand.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/ImportCounterCommand.cs index a6bd86dd8e..eceba8c13b 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/ImportCounterCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/ImportCounterCommand.cs @@ -362,7 +362,7 @@ namespace Microsoft.PowerShell.Commands { categoryType = PerformanceCounterCategoryType.MultiInstance; } - else //if (counterSetInstances.Count == 1) //??? + else // if (counterSetInstances.Count == 1) //??? { categoryType = PerformanceCounterCategoryType.SingleInstance; } diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs index 5987ec67d3..cf3c42f357 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs @@ -228,11 +228,11 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative public Int64 largeValue; - //[FieldOffset (4), MarshalAs(UnmanagedType.LPStr)] - //public string AnsiStringValue; + // [FieldOffset (4), MarshalAs(UnmanagedType.LPStr)] + // public string AnsiStringValue; - //[FieldOffset(4), MarshalAs(UnmanagedType.LPWStr)] - //public string WideStringValue; + // [FieldOffset(4), MarshalAs(UnmanagedType.LPWStr)] + // public string WideStringValue; }; [StructLayout(LayoutKind.Sequential)] @@ -308,13 +308,13 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative [DllImport("pdh.dll", CharSet = CharSet.Unicode)] private static extern uint PdhAddCounter(PdhSafeQueryHandle queryHandle, string counterPath, IntPtr userData, out IntPtr counterHandle); - //Win7+ only + // Win7+ only [DllImport("pdh.dll", CharSet = CharSet.Unicode)] private static extern uint PdhAddRelogCounter(PdhSafeQueryHandle queryHandle, string counterPath, UInt32 counterType, UInt32 counterDefaultScale, UInt64 timeBase, out IntPtr counterHandle); - //not on XP + // not on XP [DllImport("pdh.dll")] private static extern uint PdhCollectQueryDataWithTime(PdhSafeQueryHandle queryHandle, ref Int64 pllTimeStamp); @@ -337,18 +337,18 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative out PdhSafeLogHandle phLog ); - //Win7+ only + // Win7+ only [DllImport("pdh.dll", CharSet = CharSet.Unicode)] private static extern void PdhResetRelogCounterValues(PdhSafeLogHandle LogHandle); - //Win7+ only + // Win7+ only [DllImport("pdh.dll", CharSet = CharSet.Unicode)] private static extern uint PdhSetCounterValue(IntPtr CounterHandle, ref PDH_RAW_COUNTER Value, /*PPDH_RAW_COUNTER */ string InstanceName ); - //Win7+ only + // Win7+ only [DllImport("pdh.dll")] private static extern uint PdhWriteRelogSample(PdhSafeLogHandle LogHandle, Int64 Timestamp @@ -385,7 +385,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative [DllImport("pdh.dll", CharSet = CharSet.Unicode)] private static extern uint PdhParseCounterPath(string szFullPathBuffer, - IntPtr pCounterPathElements, //PDH_COUNTER_PATH_ELEMENTS + IntPtr pCounterPathElements, // PDH_COUNTER_PATH_ELEMENTS ref IntPtr pdwBufferSize, uint dwFlags); @@ -396,15 +396,15 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative ref IntPtr pcchPathListLength, uint dwFlags); - //not available on XP + // not available on XP [DllImport("pdh.dll", CharSet = CharSet.Unicode)] private static extern uint PdhValidatePathEx(PdhSafeDataSourceHandle hDataSource, string szFullPathBuffer); [DllImport("pdh.dll", CharSet = CharSet.Unicode)] private static extern uint PdhValidatePath(string szFullPathBuffer); - //not available on XP - [DllImport("pdh.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall, PreserveSig = true)] //private export + // not available on XP + [DllImport("pdh.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall, PreserveSig = true)] // private export private static extern IntPtr PdhGetExplainText(string szMachineName, string szObjectName, string szCounterName); [DllImport("pdh.dll", CharSet = CharSet.Unicode)] @@ -517,7 +517,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative res = PdhGetCounterInfo(hCounter, false, ref pBufferSize, bufCounterInfo); if (res == 0 && bufCounterInfo != IntPtr.Zero) { - //PDH_COUNTER_INFO pdhCounterInfo = (PDH_COUNTER_INFO)Marshal.PtrToStructure(bufCounterInfo, typeof(PDH_COUNTER_INFO)); + // PDH_COUNTER_INFO pdhCounterInfo = (PDH_COUNTER_INFO)Marshal.PtrToStructure(bufCounterInfo, typeof(PDH_COUNTER_INFO)); counterType = (uint)Marshal.ReadInt32(bufCounterInfo, 4); defaultScale = (uint)Marshal.ReadInt32(bufCounterInfo, 20); @@ -547,7 +547,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative uint res = PdhHelper.PdhBindInputDataSource(out _hDataSource, null); if (res != 0) { - //Console.WriteLine("error in PdhBindInputDataSource: " + res); + // Console.WriteLine("error in PdhBindInputDataSource: " + res); return res; } @@ -568,7 +568,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative uint res = PdhHelper.PdhBindInputDataSource(out _hDataSource, dataSourceName); if (res != 0) { - //Console.WriteLine("error in PdhBindInputDataSource: " + res); + // Console.WriteLine("error in PdhBindInputDataSource: " + res); } return res; @@ -598,7 +598,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative if (res != 0) { - //Console.WriteLine("error in PdhOpenQueryH: " + res); + // Console.WriteLine("error in PdhOpenQueryH: " + res); } return res; @@ -658,7 +658,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative return res; } - Int32 cChars = MachineListTcharSizePtr.ToInt32(); //should be ok on 64 bit + Int32 cChars = MachineListTcharSizePtr.ToInt32(); // should be ok on 64 bit IntPtr strMachineList = Marshal.AllocHGlobal(cChars * sizeof(char)); try @@ -717,23 +717,23 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative if (res == PdhResults.PDH_CSTATUS_NO_INSTANCE) { instanceNames.Clear(); - return 0; //masking the error + return 0; // masking the error } else if (res == PdhResults.PDH_CSTATUS_NO_OBJECT) { counterNames.Clear(); - return 0; //masking the error + return 0; // masking the error } else if (res != PdhResults.PDH_MORE_DATA) { - //Console.WriteLine("error in PdhEnumObjectItemsH 1st call: " + res); + // Console.WriteLine("error in PdhEnumObjectItemsH 1st call: " + res); return res; } Int32 cChars = pCounterBufferSize.ToInt32(); IntPtr strCountersList = (cChars > 0) ? Marshal.AllocHGlobal((cChars) * sizeof(char)) : IntPtr.Zero; - //re-set count to 0 if it is lte 2 + // re-set count to 0 if it is lte 2 if (cChars < 0) { pCounterBufferSize = new IntPtr(0); @@ -743,7 +743,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative IntPtr strInstancesList = (cChars > 0) ? Marshal.AllocHGlobal((cChars) * sizeof(char)) : IntPtr.Zero; - //re-set count to 0 if it is lte 2 + // re-set count to 0 if it is lte 2 if (cChars < 0) { pInstanceBufferSize = new IntPtr(0); @@ -757,7 +757,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative PerfDetail.PERF_DETAIL_WIZARD, 0); if (res != 0) { - //Console.WriteLine("error in PdhEnumObjectItemsH 2nd call: " + res + "\n Counter buffer size is " + // Console.WriteLine("error in PdhEnumObjectItemsH 2nd call: " + res + "\n Counter buffer size is " // + pCounterBufferSize.ToInt32() + "\n Instance buffer size is " + pInstanceBufferSize.ToInt32()); } else @@ -807,7 +807,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative foreach (string counterSet in counterSets) { - //Console.WriteLine("Counter set " + counterSet); + // Console.WriteLine("Counter set " + counterSet); StringCollection counterSetCounters = new StringCollection(); StringCollection counterSetInstances = new StringCollection(); @@ -946,7 +946,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative 0); if (res != PdhResults.PDH_MORE_DATA && res != 0) { - //Console.WriteLine("error in PdhParseCounterPath: " + res); + // Console.WriteLine("error in PdhParseCounterPath: " + res); return res; } @@ -1238,7 +1238,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative prefixInstanceMap.Add(lcPathMinusInstance, newList); } - //Console.WriteLine ("Added path " + sample.Path + " to the 1ist map with prefix " + lcPathMinusInstance); + // Console.WriteLine ("Added path " + sample.Path + " to the 1ist map with prefix " + lcPathMinusInstance); } // @@ -1276,7 +1276,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative continue; } - //now, add all actual paths to m_ReloggerPathToHandleAndInstanceMap + // now, add all actual paths to m_ReloggerPathToHandleAndInstanceMap foreach (PerformanceCounterSample sample in prefixInstanceMap[prefix]) { PDH_COUNTER_PATH_ELEMENTS pathElts = new PDH_COUNTER_PATH_ELEMENTS(); @@ -1299,12 +1299,12 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative if (!_reloggerPathToHandleAndInstanceMap.ContainsKey(sample.Path.ToLowerInvariant())) { _reloggerPathToHandleAndInstanceMap.Add(sample.Path.ToLowerInvariant(), chi); - //Console.WriteLine ("added map path:" + sample.Path ); + // Console.WriteLine ("added map path:" + sample.Path ); } } } - //TODO: verify that all counters are in the map + // TODO: verify that all counters are in the map return (_reloggerPathToHandleAndInstanceMap.Keys.Count > 0) ? 0 : res; } @@ -1409,14 +1409,14 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative res = GetCounterInfoPlus(hCounter, out counterType, out defaultScale, out timeBase); if (res != 0) { - //Console.WriteLine ("GetCounterInfoPlus for " + path + " failed with " + res); + // Console.WriteLine ("GetCounterInfoPlus for " + path + " failed with " + res); } PDH_RAW_COUNTER rawValue; res = PdhGetRawCounterValue(hCounter, out counterTypePtr, out rawValue); if (res == PdhResults.PDH_INVALID_DATA || res == PdhResults.PDH_NO_DATA) { - //Console.WriteLine ("PdhGetRawCounterValue returned " + res); + // Console.WriteLine ("PdhGetRawCounterValue returned " + res); samplesArr[sampleIndex++] = new PerformanceCounterSample(path, _consumerPathToHandleAndInstanceMap[path].InstanceName, 0, @@ -1457,7 +1457,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative out fmtValueDouble); if (res == PdhResults.PDH_INVALID_DATA || res == PdhResults.PDH_NO_DATA) { - //Console.WriteLine ("PdhGetFormattedCounterValue returned " + res); + // Console.WriteLine ("PdhGetFormattedCounterValue returned " + res); samplesArr[sampleIndex++] = new PerformanceCounterSample(path, _consumerPathToHandleAndInstanceMap[path].InstanceName, 0, @@ -1477,7 +1477,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative } else if (res != 0) { - //Console.WriteLine ("PdhGetFormattedCounterValue returned " + res); + // Console.WriteLine ("PdhGetFormattedCounterValue returned " + res); return res; } @@ -1573,7 +1573,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative res = GetCounterInfoPlus(hCounter, out counterType, out defaultScale, out timeBase); if (res != 0) { - //Console.WriteLine ("GetCounterInfoPlus for " + path + " failed with " + res); + // Console.WriteLine ("GetCounterInfoPlus for " + path + " failed with " + res); } PDH_RAW_COUNTER rawValue; diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs index 4db2998aa3..e2dfa8d216 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Computer.cs @@ -878,7 +878,7 @@ $result { _waitOnComputers.Add(computer); } - }//end foreach + } if (_waitOnComputers.Count > 0) { @@ -1059,7 +1059,7 @@ $result _status = StringUtil.Format(ComputerResources.WaitForMultipleComputers, machineCompleteRestart, _waitOnComputers.Count); _percent = machineCompleteRestart * 100 / _waitOnComputers.Count; } - }// end while(true) + } if (_timeUp) { @@ -1081,9 +1081,9 @@ $result // Wait for PowerShell. All computers that finished restarting are put in "allDoneList" } while (false); } - }// end if(waitOnComputer.Count > 0) - }//end DefaultParameter - }//End Processrecord + } + } + } /// /// to implement ^C. @@ -1203,7 +1203,7 @@ $result flags[0] = forcedShutdown; ProcessWSManProtocol(flags); - }//End Processrecord + } /// /// to implement ^C. @@ -1302,7 +1302,7 @@ $result /// /// Emit the output. /// - //[Alias("Restart")] + // [Alias("Restart")] [Parameter] public SwitchParameter PassThru { get; set; } @@ -1446,7 +1446,7 @@ $result { Timeout = TimeSpan.FromMilliseconds(10000), CancellationToken = cancelTokenSource.Token, - //This prefix works against all versions of the WinRM server stack, both win8 and win7 + // This prefix works against all versions of the WinRM server stack, both win8 and win7 ResourceUriPrefix = new Uri(ComputerWMIHelper.CimUriPrefix) }; @@ -2098,7 +2098,7 @@ $result { Timeout = TimeSpan.FromMilliseconds(10000), CancellationToken = cancelToken, - //This prefix works against all versions of the WinRM server stack, both win8 and win7 + // This prefix works against all versions of the WinRM server stack, both win8 and win7 ResourceUriPrefix = new Uri(ComputerWMIHelper.CimUriPrefix) }; @@ -2256,6 +2256,6 @@ $result } } #endregion Helper -}//End namespace +} #endif diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs index 073ad7a35d..7985411cef 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs @@ -435,9 +435,9 @@ namespace Microsoft.PowerShell.Commands if (!AsBaseObject) { - //wrapping in PSobject to insert into PStypesnames + // wrapping in PSobject to insert into PStypesnames PSObject logentry = new PSObject(entry); - //inserting at zero position in reverse order + // inserting at zero position in reverse order logentry.TypeNames.Insert(0, logentry.ImmediateBaseObject + "#" + log.Log + "/" + entry.Source); logentry.TypeNames.Insert(0, logentry.ImmediateBaseObject + "#" + log.Log + "/" + entry.Source + "/" + entry.InstanceId); WriteObject(logentry); @@ -618,11 +618,11 @@ namespace Microsoft.PowerShell.Commands return matchingLogs; } - //private string ErrorBase = "EventlogResources"; + // private string ErrorBase = "EventlogResources"; private DateTime _initial = new DateTime(); #endregion Private - }//GetEventLogCommand + } #endregion GetEventLogCommand #region ClearEventLogCommand @@ -715,10 +715,10 @@ namespace Microsoft.PowerShell.Commands } } - //beginprocessing + // beginprocessing #endregion Overrides - }//ClearEventLogCommand + } #endregion ClearEventLogCommand #region WriteEventLogCommand @@ -862,10 +862,10 @@ namespace Microsoft.PowerShell.Commands { WriteNonTerminatingError(ex, "PathDoesNotExist", StringUtil.Format(EventlogResources.PathDoesNotExist, null, ComputerName, null), ErrorCategory.InvalidOperation); } - }//beginprocessing + } #endregion Overrides - }//WriteEventLogCommand + } #endregion WriteEventLogCommand #region LimitEventLogCommand @@ -1302,9 +1302,9 @@ namespace Microsoft.PowerShell.Commands } } } - //End BeginProcessing() + // End BeginProcessing() #endregion override - }//End Class + } #endregion NewEventLogCommand #region RemoveEventLogCommand @@ -1444,9 +1444,9 @@ namespace Microsoft.PowerShell.Commands ErrorRecord er = new ErrorRecord(ex, "NewEventlogException", ErrorCategory.SecurityError, null); WriteError(er); } - }//End BeginProcessing() - }//End Class + } + } #endregion RemoveEventLogCommand -}//Microsoft.PowerShell.Commands +} diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs index 60ddd60bd2..9bb553352e 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs @@ -204,7 +204,7 @@ namespace Microsoft.PowerShell.Commands if (_namedProperties != null) { - //var output = CreateCustomOutputObject(namedProperties, systemInfo, osInfo, miscInfo); + // var output = CreateCustomOutputObject(namedProperties, systemInfo, osInfo, miscInfo); var output = CreateCustomOutputObject(infoOutput, _namedProperties); WriteObject(output); @@ -552,7 +552,7 @@ namespace Microsoft.PowerShell.Commands // get platform role try { - //TODO: Local machine only. Check for that? + // TODO: Local machine only. Check for that? uint powerRole = Native.PowerDeterminePlatformRoleEx(Native.POWER_PLATFORM_ROLE_V2); if (powerRole >= (uint)PowerPlatformRole.MaximumEnumValue) rv.powerPlatformRole = PowerPlatformRole.Unspecified; @@ -566,11 +566,11 @@ namespace Microsoft.PowerShell.Commands } // get secure-boot info - //TODO: Local machine only? Check for that? + // TODO: Local machine only? Check for that? rv.firmwareType = GetFirmwareType(); // get amount of memory physically installed - //TODO: Local machine only. Check for that? + // TODO: Local machine only. Check for that? rv.physicallyInstalledMemory = GetPhysicallyInstalledSystemMemory(); // get time zone @@ -890,7 +890,7 @@ namespace Microsoft.PowerShell.Commands if (otherInfo.keyboards.Length > 0) { - //TODO: handle multiple keyboards? + // TODO: handle multiple keyboards? // there might be several keyboards found. For the moment // we display info for only one @@ -1617,7 +1617,7 @@ namespace Microsoft.PowerShell.Commands [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")] internal class WMiLogicalMemory { - //TODO: fill this in!!! + // TODO: fill this in!!! public uint? TotalPhysicalMemory; } @@ -2379,7 +2379,7 @@ namespace Microsoft.PowerShell.Commands /// /// Date and time the object was installed. /// - //TODO: do we want this? On my system this is null + // TODO: do we want this? On my system this is null public DateTime? BiosInstallDate { get; internal set; } /// @@ -2486,7 +2486,7 @@ namespace Microsoft.PowerShell.Commands /// /// System hardware security settings for administrator password status. /// - //public AdminPasswordStatus? CsAdminPasswordStatus { get; internal set; } + // public AdminPasswordStatus? CsAdminPasswordStatus { get; internal set; } public HardwareSecurity? CsAdminPasswordStatus { get; internal set; } @@ -2535,12 +2535,12 @@ namespace Microsoft.PowerShell.Commands /// /// The name of this computer. /// - public string CsCaption { get; internal set; } //TODO: remove this? Same as CsName??? + public string CsCaption { get; internal set; } // TODO: remove this? Same as CsName??? /// /// Boot up state of the chassis. /// - //public ChassisBootupState? CsChassisBootupState { get; internal set; } + // public ChassisBootupState? CsChassisBootupState { get; internal set; } public SystemElementState? CsChassisBootupState { get; internal set; } @@ -2597,7 +2597,7 @@ namespace Microsoft.PowerShell.Commands /// /// Hardware security setting for the reset button on a computer. /// - //public FrontPanelResetStatus? CsFrontPanelResetStatus { get; internal set; } + // public FrontPanelResetStatus? CsFrontPanelResetStatus { get; internal set; } public HardwareSecurity? CsFrontPanelResetStatus { get; internal set; } @@ -2624,7 +2624,7 @@ namespace Microsoft.PowerShell.Commands /// /// System hardware security setting for Keyboard Password Status. /// - //public KeyboardPasswordStatus? CsKeyboardPasswordStatus { get; internal set; } + // public KeyboardPasswordStatus? CsKeyboardPasswordStatus { get; internal set; } public HardwareSecurity? CsKeyboardPasswordStatus { get; internal set; } @@ -2647,7 +2647,7 @@ namespace Microsoft.PowerShell.Commands /// /// Key of a CIM_System instance in an enterprise environment. /// - public string CsName { get; internal set; } //TODO: get rid of this? Is this about CIM rather than about the computer? + public string CsName { get; internal set; } /// /// An array of objects describing any @@ -2736,7 +2736,7 @@ namespace Microsoft.PowerShell.Commands /// /// System hardware security setting for Power-On Password Status. /// - //public PowerOnPasswordStatus? CsPowerOnPasswordStatus { get; internal set; } + // public PowerOnPasswordStatus? CsPowerOnPasswordStatus { get; internal set; } public HardwareSecurity? CsPowerOnPasswordStatus { get; internal set; } @@ -2748,7 +2748,7 @@ namespace Microsoft.PowerShell.Commands /// /// State of the power supply or supplies when last booted. /// - //public PowerSupplyState? CsPowerSupplyState { get; internal set; } + // public PowerSupplyState? CsPowerSupplyState { get; internal set; } public SystemElementState? CsPowerSupplyState { get; internal set; } @@ -2819,7 +2819,7 @@ namespace Microsoft.PowerShell.Commands /// /// Thermal state of the system when last booted. /// - //public ThermalState? CsThermalState { get; internal set; } + // public ThermalState? CsThermalState { get; internal set; } public SystemElementState? CsThermalState { get; internal set; } @@ -3360,7 +3360,7 @@ namespace Microsoft.PowerShell.Commands // // This value is reserved // - //Reserved = 0, + // Reserved = 0, /// /// Boot into operating system. @@ -3603,12 +3603,12 @@ namespace Microsoft.PowerShell.Commands // // This value is reserved // - //Reserved_5 = 5, + // Reserved_5 = 5, // // This value is reserved // - //Reserved_6 = 6, + // Reserved_6 = 6, /// /// CPU is in another state. @@ -3621,7 +3621,7 @@ namespace Microsoft.PowerShell.Commands /// public enum DataExecutionPreventionSupportPolicy { - //Unknown = -1, + // Unknown = -1, /// /// DEP is turned off for all 32-bit applications on the computer with no exceptions. @@ -4695,7 +4695,7 @@ namespace Microsoft.PowerShell.Commands /// Specifies the type of the computer in use, such as laptop, desktop, or Tablet. /// This is an extended version of PCSystemType. /// - //TODO: conflate these two enums??? + // TODO: conflate these two enums??? public enum PCSystemTypeEx { /// @@ -4930,7 +4930,7 @@ namespace Microsoft.PowerShell.Commands // // This value is reserved // - //Reserved = 0, + // Reserved = 0, /// /// An event other than specified in this enumeration. diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs index 15394d8d36..c355cc4c63 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs @@ -141,15 +141,15 @@ namespace Microsoft.PowerShell.Commands catch (SystemException) // thrown by SecurityIdentifier.constr { } - //catch (ArgumentException) // thrown (indirectly) by SecurityIdentifier.constr (on XP only?) - //{ catch not needed - this is already caught as SystemException - //} - //catch (PlatformNotSupportedException) // thrown (indirectly) by SecurityIdentifier.Translate (on Win95 only?) - //{ catch not needed - this is already caught as SystemException - //} - //catch (UnauthorizedAccessException) // thrown (indirectly) by SecurityIdentifier.Translate - //{ catch not needed - this is already caught as SystemException - //} + // catch (ArgumentException) // thrown (indirectly) by SecurityIdentifier.constr (on XP only?) + // { catch not needed - this is already caught as SystemException + // } + // catch (PlatformNotSupportedException) // thrown (indirectly) by SecurityIdentifier.Translate (on Win95 only?) + // { catch not needed - this is already caught as SystemException + // } + // catch (UnauthorizedAccessException) // thrown (indirectly) by SecurityIdentifier.Translate + // { catch not needed - this is already caught as SystemException + // } } WriteObject(obj); @@ -167,7 +167,7 @@ namespace Microsoft.PowerShell.Commands this.Dispose(); } } - }//end of BeginProcessing method + } /// /// to implement ^C. @@ -240,6 +240,6 @@ namespace Microsoft.PowerShell.Commands } #endregion "IDisposable Members" - }//end class + } #endregion -}//Microsoft.Powershell.commands +} diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/InvokeWMIMethodCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/InvokeWMIMethodCommand.cs index 42cf2ede6a..9a21cceadf 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/InvokeWMIMethodCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/InvokeWMIMethodCommand.cs @@ -163,7 +163,7 @@ namespace Microsoft.PowerShell.Commands } else if (namespaceSpecified) { - //ThrowTerminatingError + // ThrowTerminatingError ThrowTerminatingError(new ErrorRecord( new InvalidOperationException(), "NamespaceSpecifiedWithPath", @@ -173,14 +173,14 @@ namespace Microsoft.PowerShell.Commands if (mPath.Server != "." && serverNameSpecified) { - //ThrowTerminatingError + // ThrowTerminatingError ThrowTerminatingError(new ErrorRecord( new InvalidOperationException(), "ComputerNameSpecifiedWithPath", ErrorCategory.InvalidOperation, ComputerName)); } - //If server name is specified loop through it. + // If server name is specified loop through it. if (!(mPath.Server == "." && serverNameSpecified)) { string[] serverName = new string[] { mPath.Server }; @@ -268,7 +268,7 @@ namespace Microsoft.PowerShell.Commands } } } - }//ProcessRecord + } /// /// Ensure that the argument is a collection containing no PSObjects. @@ -314,5 +314,5 @@ namespace Microsoft.PowerShell.Commands } #endregion Command code - }//InvokeWMIObject + } } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs index 83d606d073..741daebcdd 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs @@ -963,7 +963,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ProcessRecord() { - //adding the processes into the list + // adding the processes into the list foreach (Process process in MatchingProcesses()) { // Idle process has processid zero,so handle that because we cannot wait on it. diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs index 1389691ef5..f40acce671 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs @@ -105,7 +105,7 @@ namespace Microsoft.PowerShell.Commands string wmiQuery = this.Query; if (this.Class != null) { - //Validate class format + // Validate class format for (int i = 0; i < this.Class.Length; i++) { if (Char.IsLetterOrDigit(this.Class[i]) || this.Class[i].Equals('_')) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/RemoveWMIObjectCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/RemoveWMIObjectCommand.cs index 40b451b7c5..c9fb150b76 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/RemoveWMIObjectCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/RemoveWMIObjectCommand.cs @@ -104,7 +104,7 @@ namespace Microsoft.PowerShell.Commands } else if (namespaceSpecified) { - //ThrowTerminatingError + // ThrowTerminatingError ThrowTerminatingError(new ErrorRecord( new InvalidOperationException(), "NamespaceSpecifiedWithPath", @@ -114,7 +114,7 @@ namespace Microsoft.PowerShell.Commands if (mPath.Server != "." && serverNameSpecified) { - //ThrowTerminatingError + // ThrowTerminatingError ThrowTerminatingError(new ErrorRecord( new InvalidOperationException(), "ComputerNameSpecifiedWithPath", diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs index f966c954da..dd6691eb85 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs @@ -1435,7 +1435,7 @@ namespace Microsoft.PowerShell.Commands continue; } - //Set the NoWait parameter to false since we are not adding this switch to this cmdlet. + // Set the NoWait parameter to false since we are not adding this switch to this cmdlet. List stoppedServices = DoStopService(serviceController, Force, true); if (stoppedServices.Count > 0) @@ -1598,7 +1598,7 @@ namespace Microsoft.PowerShell.Commands /// /// This is not a parameter for this cmdlet. /// - //This has been shadowed from base class and removed parameter tag to fix gcm "Set-Service" -syntax + // This has been shadowed from base class and removed parameter tag to fix gcm "Set-Service" -syntax [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public new string[] Include { @@ -1618,7 +1618,7 @@ namespace Microsoft.PowerShell.Commands /// /// This is not a parameter for this cmdlet. /// - //This has been shadowed from base class and removed parameter tag to fix gcm "Set-Service" -syntax + // This has been shadowed from base class and removed parameter tag to fix gcm "Set-Service" -syntax [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public new string[] Exclude { @@ -1669,14 +1669,14 @@ namespace Microsoft.PowerShell.Commands } catch (ArgumentException ex) { - //cannot use WriteNonterminatingError as service is null + // cannot use WriteNonterminatingError as service is null ErrorRecord er = new ErrorRecord(ex, "ArgumentException", ErrorCategory.ObjectNotFound, Name); WriteError(er); return; } catch (InvalidOperationException ex) { - //cannot use WriteNonterminatingError as service is null + // cannot use WriteNonterminatingError as service is null ErrorRecord er = new ErrorRecord(ex, "InvalidOperationException", ErrorCategory.ObjectNotFound, Name); WriteError(er); return; @@ -1837,10 +1837,10 @@ namespace Microsoft.PowerShell.Commands if (!service.Status.Equals(ServiceControllerStatus.Running)) { if (service.Status.Equals(ServiceControllerStatus.Paused)) - //resume service + // resume service DoResumeService(service); else - //start service + // start service DoStartService(service); } } @@ -1916,7 +1916,7 @@ namespace Microsoft.PowerShell.Commands } } } - } //End try + } finally { if (IntPtr.Zero != password) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/SetClipboardCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/SetClipboardCommand.cs index 0e0e60338b..8998947dc6 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/SetClipboardCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/SetClipboardCommand.cs @@ -231,7 +231,7 @@ namespace Microsoft.PowerShell.Commands StringCollection clipBoardContent = Clipboard.GetFileDropList(); dropFiles = new HashSet(clipBoardContent.Cast().ToList(), StringComparer.OrdinalIgnoreCase); - //we need the count of original files so we can get the accurate files number that has been appended. + // we need the count of original files so we can get the accurate files number that has been appended. clipBoardContentLength = clipBoardContent.Count; } } @@ -335,15 +335,15 @@ EndSelection:<<<<<<<<4"; int fragmentEndIdx = html.LastIndexOf(EndFragment, StringComparison.OrdinalIgnoreCase); // if html tag is missing add it surrounding the given html - //find the index of " 0 ? html.IndexOf('>', htmlOpenIdx) + 1 : -1; - //find the index of " 0 ? html.IndexOf('>', bodyOpenIdx) + 1 : -1; @@ -361,7 +361,7 @@ EndSelection:<<<<<<<<4"; else { // insert start/end fragments in the proper place (related to html/body tags if exists) so the paste will work correctly - //find the index of " /// Definition of SE_TIME_ZONE_NAME constant from Win32 API. /// - public const string SE_TIME_ZONE_NAME = "SeTimeZonePrivilege"; //http://msdn.microsoft.com/library/bb530716(VS.85).aspx + public const string SE_TIME_ZONE_NAME = "SeTimeZonePrivilege"; // http://msdn.microsoft.com/library/bb530716(VS.85).aspx /// /// PInvoke GetCurrentProcess API. diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs index 3a65c72f3d..ab781f3c9f 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs @@ -160,7 +160,7 @@ namespace Microsoft.PowerShell.Commands } thread.IsBackground = true; - //thread.SetApartmentState( ApartmentState.STA); + // thread.SetApartmentState( ApartmentState.STA); thread.Start(); } @@ -204,10 +204,10 @@ namespace Microsoft.PowerShell.Commands try { PutOptions pOptions = new PutOptions(); - //Extra check + // Extra check if (setObject.InputObject.GetType() == typeof(ManagementClass)) { - //Check if Flag specified is CreateOnly or not + // Check if Flag specified is CreateOnly or not if (setObject.flagSpecified && setObject.PutType != PutType.CreateOnly) { InvalidOperationException e = new InvalidOperationException("CreateOnlyFlagNotSpecifiedWithClassPath"); @@ -222,7 +222,7 @@ namespace Microsoft.PowerShell.Commands } else { - //Check if Flag specified is Updateonly or UpdateOrCreateOnly or not + // Check if Flag specified is Updateonly or UpdateOrCreateOnly or not if (setObject.flagSpecified) { if (!(setObject.PutType == PutType.UpdateOnly || setObject.PutType == PutType.UpdateOrCreate)) @@ -286,7 +286,7 @@ namespace Microsoft.PowerShell.Commands else { ManagementPath mPath = null; - //If Class is specified only CreateOnly flag is supported + // If Class is specified only CreateOnly flag is supported if (setObject.Class != null) { if (setObject.flagSpecified && setObject.PutType != PutType.CreateOnly) @@ -357,7 +357,7 @@ namespace Microsoft.PowerShell.Commands } } } - //If server name is specified loop through it. + // If server name is specified loop through it. if (mPath != null) { if (!(mPath.Server == "." && setObject.serverNameSpecified)) @@ -382,7 +382,7 @@ namespace Microsoft.PowerShell.Commands } else { - //This can throw if path does not exist caller should catch it. + // This can throw if path does not exist caller should catch it. ManagementObject mInstance = new ManagementObject(mPath); mInstance.Scope = mScope; try @@ -416,7 +416,7 @@ namespace Microsoft.PowerShell.Commands RaiseOperationCompleteEvent(null, OperationState.StopComplete); return; } - //Get class object and create instance. + // Get class object and create instance. string newPath = setObject.Path.Substring(0, classIndex + namespaceIndex); ManagementPath classPath = new ManagementPath(newPath); ManagementClass mClass = new ManagementClass(classPath); @@ -558,7 +558,7 @@ namespace Microsoft.PowerShell.Commands RaiseOperationCompleteEvent(null, OperationState.StopComplete); return; } - //If server name is specified loop through it. + // If server name is specified loop through it. if (!(mPath.Server == "." && invokeObject.serverNameSpecified)) { _computerName = mPath.Server; @@ -1229,7 +1229,7 @@ namespace Microsoft.PowerShell.Commands } else { - //This can throw if path does not exist caller should catch it. + // This can throw if path does not exist caller should catch it. ManagementObject mInstance = new ManagementObject(mPath); mInstance.Scope = mScope; try @@ -1254,7 +1254,7 @@ namespace Microsoft.PowerShell.Commands { throw; } - //Get class object and create instance. + // Get class object and create instance. string newPath = setObject.Path.Substring(0, classIndex + namespaceIndex); ManagementPath classPath = new ManagementPath(newPath); ManagementClass mClass = new ManagementClass(classPath); @@ -1294,12 +1294,12 @@ namespace Microsoft.PowerShell.Commands var wmiInstance = this as SetWmiInstance; if (wmiInstance != null) { - //If Class is specified only CreateOnly flag is supported + // If Class is specified only CreateOnly flag is supported if (wmiInstance.Class != null) { if (wmiInstance.flagSpecified && wmiInstance.PutType != PutType.CreateOnly) { - //Throw Terminating error + // Throw Terminating error ThrowTerminatingError(new ErrorRecord( new InvalidOperationException(), "CreateOnlyFlagNotSpecifiedWithClassPath", @@ -1318,7 +1318,7 @@ namespace Microsoft.PowerShell.Commands } else if (wmiInstance.namespaceSpecified) { - //ThrowTerminatingError + // ThrowTerminatingError ThrowTerminatingError(new ErrorRecord( new InvalidOperationException(), "NamespaceSpecifiedWithPath", @@ -1328,7 +1328,7 @@ namespace Microsoft.PowerShell.Commands if (mPath.Server != "." && wmiInstance.serverNameSpecified) { - //ThrowTerminatingError + // ThrowTerminatingError ThrowTerminatingError(new ErrorRecord( new InvalidOperationException(), "ComputerNameSpecifiedWithPath", @@ -1340,7 +1340,7 @@ namespace Microsoft.PowerShell.Commands { if (wmiInstance.flagSpecified && wmiInstance.PutType != PutType.CreateOnly) { - //Throw Terminating error + // Throw Terminating error ThrowTerminatingError(new ErrorRecord( new InvalidOperationException(), "CreateOnlyFlagNotSpecifiedWithClassPath", @@ -1356,7 +1356,7 @@ namespace Microsoft.PowerShell.Commands { if (!(wmiInstance.PutType == PutType.UpdateOnly || wmiInstance.PutType == PutType.UpdateOrCreate)) { - //Throw terminating error + // Throw terminating error ThrowTerminatingError(new ErrorRecord( new InvalidOperationException(), "NonUpdateFlagSpecifiedWithInstancePath", @@ -1380,20 +1380,20 @@ namespace Microsoft.PowerShell.Commands /// internal ManagementObject SetWmiInstanceGetPipelineObject() { - //Should only be called from Set-WMIInstance cmdlet + // Should only be called from Set-WMIInstance cmdlet ManagementObject mObj = null; var wmiInstance = this as SetWmiInstance; if (wmiInstance != null) { - //Extra check + // Extra check if (wmiInstance.InputObject != null) { if (wmiInstance.InputObject.GetType() == typeof(ManagementClass)) { - //Check if Flag specified is CreateOnly or not + // Check if Flag specified is CreateOnly or not if (wmiInstance.flagSpecified && wmiInstance.PutType != PutType.CreateOnly) { - //Throw terminating error + // Throw terminating error ThrowTerminatingError(new ErrorRecord( new InvalidOperationException(), "CreateOnlyFlagNotSpecifiedWithClassPath", @@ -1406,12 +1406,12 @@ namespace Microsoft.PowerShell.Commands } else { - //Check if Flag specified is Updateonly or UpdateOrCreateOnly or not + // Check if Flag specified is Updateonly or UpdateOrCreateOnly or not if (wmiInstance.flagSpecified) { if (!(wmiInstance.PutType == PutType.UpdateOnly || wmiInstance.PutType == PutType.UpdateOrCreate)) { - //Throw terminating error + // Throw terminating error ThrowTerminatingError(new ErrorRecord( new InvalidOperationException(), "NonUpdateFlagSpecifiedWithInstancePath", @@ -1539,7 +1539,7 @@ namespace Microsoft.PowerShell.Commands return; } - //Ignore state changes which are not resulting in state change to finished. + // Ignore state changes which are not resulting in state change to finished. if ((!IsFinishedState(e.JobStateInfo.State)) || (e.JobStateInfo.State == JobState.NotStarted)) { return; @@ -1547,7 +1547,7 @@ namespace Microsoft.PowerShell.Commands if (e.JobStateInfo.State == JobState.Failed) { - //If any of the child job failed, we set status to failed + // If any of the child job failed, we set status to failed _atleastOneChildJobFailed = true; } @@ -1556,7 +1556,7 @@ namespace Microsoft.PowerShell.Commands { _finishedChildJobsCount++; - //We are done + // We are done if (_finishedChildJobsCount == ChildJobs.Count) { allChildJobsFinished = true; @@ -1565,9 +1565,9 @@ namespace Microsoft.PowerShell.Commands if (allChildJobsFinished) { - //if any child job failed, set status to failed - //If stop was called set, status to stopped - //else completed + // if any child job failed, set status to failed + // If stop was called set, status to stopped + // else completed if (_atleastOneChildJobFailed) { SetJobState(JobState.Failed); @@ -1595,7 +1595,7 @@ namespace Microsoft.PowerShell.Commands return _statusMessage; } } - //ISSUE: Implement StatusMessage + // ISSUE: Implement StatusMessage /// /// Checks the status of remote command execution. /// @@ -1617,10 +1617,10 @@ namespace Microsoft.PowerShell.Commands get { // moreData is set to false and will be set to true - //if at least one child is has more data. + // if at least one child is has more data. - //if ( (!moreData)) - //{ + // if ( (!moreData)) + // { bool atleastOneChildHasMoreData = false; for (int i = 0; i < ChildJobs.Count; i++) @@ -1633,7 +1633,7 @@ namespace Microsoft.PowerShell.Commands } _moreData = atleastOneChildHasMoreData; - //} + // } return _moreData; } @@ -1669,7 +1669,7 @@ namespace Microsoft.PowerShell.Commands /// public override void StopJob() { - //AssertNotDisposed(); + // AssertNotDisposed(); if (!IsFinishedState(JobStateInfo.State)) { @@ -1720,8 +1720,8 @@ namespace Microsoft.PowerShell.Commands /// private void CommonInit(int throttleLimit) { - //Since no results are produced by any streams. We should - //close all the streams + // Since no results are produced by any streams. We should + // close all the streams base.CloseAllStreams(); // set status to "in progress" @@ -1824,7 +1824,7 @@ namespace Microsoft.PowerShell.Commands #endregion internal constructor private WmiAsyncCmdletHelper _helper; - //bool _bFinished; + // bool _bFinished; private ThrottleManager _throttleManager; private object _syncObject = new object(); // sync object private int _sinkCompleted; @@ -1894,8 +1894,8 @@ namespace Microsoft.PowerShell.Commands if (_sinkCompleted == 0) { - //Notify throttle manager and change the state to complete - //Two cases where _bFinished should be set to false. + // Notify throttle manager and change the state to complete + // Two cases where _bFinished should be set to false. // 1) Invalid class or some other condition so that after making a connection WMI is throwing an error // 2) We could not get any instance for the class. /*if(bAtLeastOneObject ) @@ -2000,7 +2000,7 @@ namespace Microsoft.PowerShell.Commands if (helper.State == WmiState.NotStarted) { - //This is a case WMI operation was not started. + // This is a case WMI operation was not started. SetJobState(JobState.Stopped, helper.InternalException); } else if (helper.State == WmiState.Running) @@ -2056,7 +2056,7 @@ namespace Microsoft.PowerShell.Commands { if (_helper.State == WmiState.NotStarted) { - //This is a case WMI operation was not started. + // This is a case WMI operation was not started. SetJobState(JobState.Stopped, _helper.InternalException); } else if (_helper.State == WmiState.Running) @@ -2075,7 +2075,7 @@ namespace Microsoft.PowerShell.Commands { SetJobState(JobState.Stopped, _helper.InternalException); } - //Do Nothing + // Do Nothing } } } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs index bfe239a8c1..91996c7ccb 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs @@ -163,7 +163,7 @@ namespace Microsoft.PowerShell.Commands ErrorRecord er = new ErrorRecord(ex, "ArgumentException", ErrorCategory.InvalidOperation, null); ThrowTerminatingError(er); } - //check if system.web is available.This assembly is not available in win server core. + // check if system.web is available.This assembly is not available in win server core. string AssemblyString = "System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; try { @@ -182,7 +182,7 @@ namespace Microsoft.PowerShell.Commands { if (s_uriCache.ContainsKey(_uri)) { - //if uri is present in the cache + // if uri is present in the cache string ns; s_uriCache.TryGetValue(_uri, out ns); string[] data = ns.Split('|'); @@ -203,7 +203,7 @@ namespace Microsoft.PowerShell.Commands { _namespace = "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy" + GenerateRandomName(); } - //if class is null,generate a name for it + // if class is null,generate a name for it if (string.IsNullOrEmpty(_class)) { _class = "MyClass" + GenerateRandomName(); @@ -214,7 +214,7 @@ namespace Microsoft.PowerShell.Commands return; object instance = InstantiateWebServiceProxy(webserviceproxy); - //to set the credentials into the generated webproxy Object + // to set the credentials into the generated webproxy Object PropertyInfo[] pinfo = instance.GetType().GetProperties(); foreach (PropertyInfo pr in pinfo) { @@ -237,8 +237,8 @@ namespace Microsoft.PowerShell.Commands } } - //disposing the entries in a cache - //Adding to Cache + // disposing the entries in a cache + // Adding to Cache lock (s_uriCache) { s_uriCache.Remove(_uri); @@ -264,7 +264,7 @@ namespace Microsoft.PowerShell.Commands } WriteObject(instance, true); - }//End BeginProcessing() + } #endregion @@ -319,11 +319,11 @@ namespace Microsoft.PowerShell.Commands { DiscoveryClientProtocol dcp = new DiscoveryClientProtocol(); - //if paramset is defaultcredential, set the flag in wcclient + // if paramset is defaultcredential, set the flag in wcclient if (_usedefaultcredential.IsPresent) dcp.UseDefaultCredentials = true; - //if paramset is credential, assign the credentials + // if paramset is credential, assign the credentials if (ParameterSetName.Equals("Credential", StringComparison.OrdinalIgnoreCase)) dcp.Credentials = _credential.GetNetworkCredential(); @@ -353,7 +353,7 @@ namespace Microsoft.PowerShell.Commands if (!string.IsNullOrEmpty(NameSpace)) codeNS.Name = NameSpace; - //create the class and add it to the namespace + // create the class and add it to the namespace if (!string.IsNullOrEmpty(ClassName)) { CodeTypeDeclaration codeClass = new CodeTypeDeclaration(ClassName); @@ -362,12 +362,12 @@ namespace Microsoft.PowerShell.Commands codeNS.Types.Add(codeClass); } - //create a web reference to the uri docs + // create a web reference to the uri docs WebReference wref = new WebReference(dcp.Documents, codeNS); WebReferenceCollection wrefs = new WebReferenceCollection(); wrefs.Add(wref); - //create a codecompileunit and add the namespace to it + // create a codecompileunit and add the namespace to it CodeCompileUnit codecompileunit = new CodeCompileUnit(); codecompileunit.Namespaces.Add(codeNS); @@ -375,7 +375,7 @@ namespace Microsoft.PowerShell.Commands wrefOptions.CodeGenerationOptions = System.Xml.Serialization.CodeGenerationOptions.GenerateNewAsync | System.Xml.Serialization.CodeGenerationOptions.GenerateOldAsync | System.Xml.Serialization.CodeGenerationOptions.GenerateProperties; wrefOptions.Verbose = true; - //create a csharpprovider and compile it + // create a csharpprovider and compile it CSharpCodeProvider csharpprovider = new CSharpCodeProvider(); StringCollection Warnings = ServiceDescriptionImporter.GenerateWebReferences(wrefs, csharpprovider, codecompileunit, wrefOptions); @@ -390,10 +390,10 @@ namespace Microsoft.PowerShell.Commands ErrorRecord er = new ErrorRecord(ex, "NotImplementedException", ErrorCategory.ObjectNotFound, _uri); WriteError(er); } - //generate the hashcode of the CodeCompileUnit + // generate the hashcode of the CodeCompileUnit _sourceHash = codegenerator.ToString().GetHashCode(); - //if the sourcehash matches the hashcode in the cache,the proxy hasnt changed and so + // if the sourcehash matches the hashcode in the cache,the proxy hasnt changed and so // return the instance of th eproxy in the cache if (s_srccodeCache.ContainsKey(_sourceHash)) { @@ -462,7 +462,7 @@ namespace Microsoft.PowerShell.Commands private object InstantiateWebServiceProxy(Assembly assembly) { Type proxyType = null; - //loop through the types of the assembly and identify the type having + // loop through the types of the assembly and identify the type having // a web service binding attribute foreach (Type type in assembly.GetTypes()) { @@ -484,6 +484,6 @@ namespace Microsoft.PowerShell.Commands } #endregion - }//end class + } #endregion -}//Microsoft.Powershell.commands +} diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs index 56ef96489e..0d02be4d54 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs @@ -274,7 +274,7 @@ namespace Microsoft.PowerShell.Commands } if (!_shouldProcess) return; - //Process first object + // Process first object if (_propertyNames == null) { // figure out the column names (and lock-in their order) @@ -712,7 +712,7 @@ namespace Microsoft.PowerShell.Commands { return; } - //Process first object + // Process first object if (_propertyNames == null) { _propertyNames = _helper.BuildPropertyNames(InputObject, _propertyNames); @@ -720,14 +720,14 @@ namespace Microsoft.PowerShell.Commands { WriteCsvLine(_helper.GetTypeString(InputObject)); } - //Write property information + // Write property information string properties = _helper.ConvertPropertyNamesCSV(_propertyNames); if (!properties.Equals(string.Empty)) WriteCsvLine(properties); } string csv = _helper.ConvertPSObjectToCSV(InputObject, _propertyNames); - //write to the console + // write to the console if (csv != string.Empty) WriteCsvLine(csv); } @@ -890,7 +890,7 @@ namespace Microsoft.PowerShell.Commands _delimiter = delimiter; } - //Name of properties to be written in CSV format + // Name of properties to be written in CSV format /// /// Get the name of properties from source PSObject and add them to _propertyNames. @@ -941,7 +941,7 @@ namespace Microsoft.PowerShell.Commands } else { - //changed to delimiter + // changed to delimiter dest.Append(_delimiter); } @@ -981,7 +981,7 @@ namespace Microsoft.PowerShell.Commands PSPropertyInfo property = mshObject.Properties[propertyName] as PSPropertyInfo; string value = null; - //If property is not present, assume value is null + // If property is not present, assume value is null if (property != null) { value = GetToStringValueForProperty(property); @@ -1016,7 +1016,7 @@ namespace Microsoft.PowerShell.Commands value = temp.ToString(); } } - //If we cannot read some value, treat it as null. + // If we cannot read some value, treat it as null. catch (Exception) { } @@ -1035,7 +1035,7 @@ namespace Microsoft.PowerShell.Commands { string type = null; - //get type of source + // get type of source Collection tnh = source.TypeNames; if (tnh == null || tnh.Count == 0) { @@ -1049,8 +1049,8 @@ namespace Microsoft.PowerShell.Commands } string temp = tnh[0]; - //If type starts with CSV: remove it. This would happen when you export - //an imported object. import-csv adds CSV. prefix to the type. + // If type starts with CSV: remove it. This would happen when you export + // an imported object. import-csv adds CSV. prefix to the type. if (temp.StartsWith(ImportExportCSVHelper.CSVTypePrefix, StringComparison.OrdinalIgnoreCase)) { temp = temp.Substring(4); @@ -1075,12 +1075,12 @@ namespace Microsoft.PowerShell.Commands { return; } - //Adding Double quote to all strings + // Adding Double quote to all strings dest.Append('"'); for (int i = 0; i < source.Length; i++) { char c = source[i]; - //Double quote in the string is escaped with double quote + // Double quote in the string is escaped with double quote if ((c == '"')) { dest.Append('"'); @@ -1249,7 +1249,7 @@ namespace Microsoft.PowerShell.Commands internal void ReadHeader() { - //Read #Type record if available + // Read #Type record if available if ((TypeName == null) && (!this.EOF)) { TypeName = ReadTypeInformation(); @@ -1333,7 +1333,7 @@ namespace Microsoft.PowerShell.Commands { if (names.Count == 0) { - //If there are no names, it is an error + // If there are no names, it is an error } else { @@ -1404,23 +1404,23 @@ namespace Microsoft.PowerShell.Commands // int i = 0; while (!EOF) { - //Read the next character + // Read the next character char ch = ReadChar(); if ((ch == _delimiter)) { if (seenBeginQuote) { - //Delimiter inside double quotes is part of string. - //Ex: - //"foo, bar" - //is parsed as - //->foo, bar<- + // Delimiter inside double quotes is part of string. + // Ex: + // "foo, bar" + // is parsed as + // ->foo, bar<- current.Append(ch); } else { - //Delimiter outside quotes is end of current word. + // Delimiter outside quotes is end of current word. result.Add(current.ToString()); current.Remove(0, current.Length); } @@ -1431,32 +1431,32 @@ namespace Microsoft.PowerShell.Commands { if (PeekNextChar('"')) { - //"" inside double quote are single quote - //ex: "foo""bar" - //is read as - //->foo"bar<- + // "" inside double quote are single quote + // ex: "foo""bar" + // is read as + // ->foo"bar<- - //PeekNextChar only peeks. Read the next char. + // PeekNextChar only peeks. Read the next char. ReadChar(); current.Append('"'); } else { - //We have seen a matching end quote. + // We have seen a matching end quote. seenBeginQuote = false; - //Read - //everything till we hit next delimiter. - //In correct CSV,1) end quote is followed by delimiter - //2)end quote is followed some whitespaces and - //then delimiter. - //We eat the whitespaces seen after the ending quote. - //However if there are other characters, we add all of them - //to string. - //Ex: ->"foo bar"<- is read as ->foo bar<- - //->"foo bar" <- is read as ->foo bar<- - //->"foo bar" ab <- is read as ->"foo bar" ab <- + // Read + // everything till we hit next delimiter. + // In correct CSV,1) end quote is followed by delimiter + // 2)end quote is followed some whitespaces and + // then delimiter. + // We eat the whitespaces seen after the ending quote. + // However if there are other characters, we add all of them + // to string. + // Ex: ->"foo bar"<- is read as ->foo bar<- + // ->"foo bar" <- is read as ->foo bar<- + // ->"foo bar" ab <- is read as ->"foo bar" ab <- bool endofRecord = false; ReadTillNextDelimiter(current, ref endofRecord, true); result.Add(current.ToString()); @@ -1467,18 +1467,18 @@ namespace Microsoft.PowerShell.Commands } else if (current.Length == 0) { - //We are at the beginning of a new word. - //This quote is the first quote. + // We are at the beginning of a new word. + // This quote is the first quote. seenBeginQuote = true; } else { - //We are seeing a quote after the start of - //the word. This is error, however we will be - //lenient here and do what excel does: - //Ex: foo "ba,r" - //In above example word read is ->foo "ba<- - //Basically we read till next delimiter + // We are seeing a quote after the start of + // the word. This is error, however we will be + // lenient here and do what excel does: + // Ex: foo "ba,r" + // In above example word read is ->foo "ba<- + // Basically we read till next delimiter bool endOfRecord = false; current.Append(ch); ReadTillNextDelimiter(current, ref endOfRecord, false); @@ -1492,25 +1492,25 @@ namespace Microsoft.PowerShell.Commands { if (seenBeginQuote) { - //Spaces in side quote are valid + // Spaces in side quote are valid current.Append(ch); } else if (current.Length == 0) { - //ignore leading spaces + // ignore leading spaces continue; } else { - //We are not in quote and we are not at the - //beginning of a word. We should not be seeing - //spaces here. This is an error condition, however - //we will be lenient here and do what excel does, - //that is read till next delimiter. - //Ex: ->foo <- is read as ->foo<- - //Ex: ->foo bar<- is read as ->foo bar<- - //Ex: ->foo bar <- is read as ->foo bar <- - //Ex: ->foo bar "er,ror"<- is read as ->foo bar "er<- + // We are not in quote and we are not at the + // beginning of a word. We should not be seeing + // spaces here. This is an error condition, however + // we will be lenient here and do what excel does, + // that is read till next delimiter. + // Ex: ->foo <- is read as ->foo<- + // Ex: ->foo bar<- is read as ->foo bar<- + // Ex: ->foo bar <- is read as ->foo bar <- + // Ex: ->foo bar "er,ror"<- is read as ->foo bar "er<- bool endOfRecord = false; current.Append(ch); ReadTillNextDelimiter(current, ref endOfRecord, true); @@ -1525,14 +1525,14 @@ namespace Microsoft.PowerShell.Commands { if (seenBeginQuote) { - //newline inside quote are valid + // newline inside quote are valid current.Append(newLine); } else { result.Add(current.ToString()); current.Remove(0, current.Length); - //New line outside quote is end of word and end of record + // New line outside quote is end of word and end of record break; } } @@ -1639,7 +1639,7 @@ namespace Microsoft.PowerShell.Commands PSObject BuildMshobject(string type, IList names, List values, char delimiter, bool preValidated = false) { - //string[] namesarray = null; + // string[] namesarray = null; PSObject result = new PSObject(names.Count); char delimiterlocal = delimiter; int unspecifiedNameIndex = 1; @@ -1659,7 +1659,7 @@ namespace Microsoft.PowerShell.Commands name = UnspecifiedName + unspecifiedNameIndex; unspecifiedNameIndex++; } - //If no value was present in CSV file, we write null. + // If no value was present in CSV file, we write null. if (i < values.Count) { value = values[i]; @@ -1702,7 +1702,7 @@ namespace Microsoft.PowerShell.Commands switch (ParameterSetName) { case "Delimiter": - //if delimiter is not given, it should take , as value + // if delimiter is not given, it should take , as value if (Delimiter == '\0') { Delimiter = ImportExportCSVHelper.CSVDelimiter; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs index a03cbf8a3f..aba6043d2b 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Csv.cs @@ -59,8 +59,8 @@ namespace Microsoft.PowerShell.Commands case '"': if (inQuote) { - //If we are at the end of the string or the end of the segment, create a new value - //Otherwise we have an error + // If we are at the end of the string or the end of the segment, create a new value + // Otherwise we have an error if (i == csv.Length - 1) { result.Add(tempString); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CustomSerialization.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CustomSerialization.cs index c3f909f54a..0553ee9dbf 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CustomSerialization.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CustomSerialization.cs @@ -101,7 +101,7 @@ namespace System.Management.Automation /// internal void Serialize(object source) { - //Write the root element tag before writing first object. + // Write the root element tag before writing first object. if (_firstCall) { _firstCall = false; @@ -286,16 +286,16 @@ namespace System.Management.Automation return; } - //Note: We donot use containers in depth calculation. i.e even if the - //current depth is zero, we serialize the container. All contained items will - //get serialized with depth zero. + // Note: We donot use containers in depth calculation. i.e even if the + // current depth is zero, we serialize the container. All contained items will + // get serialized with depth zero. if (HandleKnownContainerTypes(source, property, depth)) { return; } PSObject mshSource = PSObject.AsPSObject(source); - //If depth is zero, complex type should be serialized as string. + // If depth is zero, complex type should be serialized as string. if (depth == 0 || SerializeAsString(mshSource)) { HandlePSObjectAsString(mshSource, property, depth); @@ -316,7 +316,7 @@ namespace System.Management.Automation { Dbg.Assert(source != null, "caller should validate the parameter"); - //Check if source is of primitive known type + // Check if source is of primitive known type TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfo(source.GetType()); if (pktInfo != null) { @@ -344,7 +344,7 @@ namespace System.Management.Automation PSObject moSource = source as PSObject; if (moSource != null && !moSource.immediateBaseObjectIsEmpty) { - //Check if baseObject is primitive known type + // Check if baseObject is primitive known type object baseObject = moSource.ImmediateBaseObject; TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfo(baseObject.GetType()); if (pktInfo != null) @@ -366,13 +366,13 @@ namespace System.Management.Automation IEnumerable enumerable = null; IDictionary dictionary = null; - //If passed in object is PSObject with no baseobject, return false. + // If passed in object is PSObject with no baseobject, return false. if (mshSource != null && mshSource.immediateBaseObjectIsEmpty) { return false; } - //Check if source (or baseobject in mshSource) is known container type + // Check if source (or baseobject in mshSource) is known container type GetKnownContainerTypeInfo(mshSource != null ? mshSource.ImmediateBaseObject : source, out ct, out dictionary, out enumerable); @@ -405,23 +405,23 @@ namespace System.Management.Automation break; } - //An object which is original enumerable becomes an PSObject - //with arraylist on deserialization. So on roundtrip it will show up - //as List. - //We serialize properties of enumerable and on deserialization mark the object - //as Deserialized. So if object is marked deserialized, we should write properties. - //Note: we do not serialize the properties of IEnumerable if depth is zero. + // An object which is original enumerable becomes an PSObject + // with arraylist on deserialization. So on roundtrip it will show up + // as List. + // We serialize properties of enumerable and on deserialization mark the object + // as Deserialized. So if object is marked deserialized, we should write properties. + // Note: we do not serialize the properties of IEnumerable if depth is zero. if (depth != 0 && (ct == ContainerType.Enumerable || (mshSource != null && mshSource.isDeserialized))) { - //Note:Depth is the depth for serialization of baseObject. - //Depth for serialization of each property is one less. + // Note:Depth is the depth for serialization of baseObject. + // Depth for serialization of each property is one less. WritePSObjectProperties(PSObject.AsPSObject(source), depth); } - //If source is PSObject, serialize notes + // If source is PSObject, serialize notes if (mshSource != null) { - //Serialize instanceMembers + // Serialize instanceMembers PSMemberInfoCollection instanceMembers = mshSource.InstanceMembers; if (instanceMembers != null) { @@ -501,7 +501,7 @@ namespace System.Management.Automation } } - //Check if type is IEnumerable + // Check if type is IEnumerable if (ct == ContainerType.None) { enumerable = LanguagePrimitives.GetEnumerable(source); @@ -566,8 +566,8 @@ namespace System.Management.Automation { Dbg.Assert(source != null, "caller should validate the parameter"); - //Write start of PSObject. Since baseobject is primitive known - //type, we do not need TypeName information. + // Write start of PSObject. Since baseobject is primitive known + // type, we do not need TypeName information. WriteStartOfPSObject(source, property, source.ToStringFromDeserialization != null); if (pktInfo != null) @@ -575,7 +575,7 @@ namespace System.Management.Automation WriteOnePrimitiveKnownType(_writer, null, primitive, pktInfo); } - //Serialize instanceMembers + // Serialize instanceMembers PSMemberInfoCollection instanceMembers = source.InstanceMembers; if (instanceMembers != null) { @@ -737,7 +737,7 @@ namespace System.Management.Automation depth = GetDepthOfSerialization(source, depth); - //Depth available for each property is one less + // Depth available for each property is one less --depth; Dbg.Assert(depth >= 0, "depth should be greater or equal to zero"); if (source.GetSerializationMethod(null) == SerializationMethod.SpecificProperties) @@ -760,8 +760,8 @@ namespace System.Management.Automation { Dbg.Assert(prop != null, "propertyCollection should only have member of type PSProperty"); object value = AutomationNull.Value; - //PSObject throws GetValueException if it cannot - //get value for a property. + // PSObject throws GetValueException if it cannot + // get value for a property. try { value = prop.Value; @@ -771,7 +771,7 @@ namespace System.Management.Automation WritePropertyWithNullValue(_writer, prop, depth); continue; } - //Write the property + // Write the property if (value == null) { WritePropertyWithNullValue(_writer, prop, depth); @@ -809,8 +809,8 @@ namespace System.Management.Automation Dbg.Assert(prop != null, "propertyCollection should only have member of type PSProperty"); object value = AutomationNull.Value; - //PSObject throws GetValueException if it cannot - //get value for a property. + // PSObject throws GetValueException if it cannot + // get value for a property. try { value = prop.Value; @@ -819,7 +819,7 @@ namespace System.Management.Automation { continue; } - //Write the property + // Write the property WriteOneObject(value, prop.Name, depth); } } @@ -852,8 +852,8 @@ namespace System.Management.Automation enumerator = null; } - //AD has incorrect implementation of IEnumerable where they returned null - //for GetEnumerator instead of empty enumerator + // AD has incorrect implementation of IEnumerable where they returned null + // for GetEnumerator instead of empty enumerator if (enumerator != null) { while (true) @@ -900,9 +900,9 @@ namespace System.Management.Automation { while (dictionaryEnum.MoveNext()) { - //Write Key + // Write Key WriteOneObject(dictionaryEnum.Key, CustomSerializationStrings.DictionaryKey, depth); - //Write Value + // Write Value WriteOneObject(dictionaryEnum.Value, CustomSerializationStrings.DictionaryValue, depth); } } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/common/GetFormatDataCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/common/GetFormatDataCommand.cs index 3a511e30bd..723c010e61 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/common/GetFormatDataCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/common/GetFormatDataCommand.cs @@ -169,7 +169,7 @@ namespace Microsoft.PowerShell.Commands } viewList.Add(formatdef); - }// foreach(ViewDefinition... + } // write out all the available type definitions foreach (var pair in typedefs) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-printer/PrinterLineOutput.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-printer/PrinterLineOutput.cs index 16abcce5e8..66538e2eb9 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-printer/PrinterLineOutput.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-printer/PrinterLineOutput.cs @@ -259,7 +259,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format linesPrinted++; } - //If we have more lines then print another page + // If we have more lines then print another page ev.HasMorePages = _lines.Count > 0; } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-string/out-string.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-string/out-string.cs index 91cae22ca6..fd403980be 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-string/out-string.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-string/out-string.cs @@ -149,7 +149,7 @@ namespace Microsoft.PowerShell.Commands { base.EndProcessing(); - //close the writer + // close the writer _writer.Flush(); _writer.Dispose(); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetAliasCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetAliasCommand.cs index 02d2651bfe..8510dffb00 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetAliasCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetAliasCommand.cs @@ -92,7 +92,7 @@ namespace Microsoft.PowerShell.Commands // First get the alias table (from the proper scope if necessary) IDictionary aliasTable = null; - //get the command origin + // get the command origin CommandOrigin origin = MyInvocation.CommandOrigin; string displayString = "name"; if (!string.IsNullOrEmpty(Scope)) @@ -140,7 +140,7 @@ namespace Microsoft.PowerShell.Commands { continue; } - //excludes pattern + // excludes pattern if (SessionStateUtilities.MatchesAnyWildcardPattern(tableEntry.Key, excludePatterns, false)) { continue; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetDateCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetDateCommand.cs index c006efccca..6e03aab658 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetDateCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetDateCommand.cs @@ -235,49 +235,49 @@ namespace Microsoft.PowerShell.Commands dateToUse = Date; } - //use passed year if specified + // use passed year if specified if (_yearSpecified) { offset = Year - dateToUse.Year; dateToUse = dateToUse.AddYears(offset); } - //use passed month if specified + // use passed month if specified if (_monthSpecified) { offset = Month - dateToUse.Month; dateToUse = dateToUse.AddMonths(offset); } - //use passed day if specified + // use passed day if specified if (_daySpecified) { offset = Day - dateToUse.Day; dateToUse = dateToUse.AddDays(offset); } - //use passed hour if specified + // use passed hour if specified if (_hourSpecified) { offset = Hour - dateToUse.Hour; dateToUse = dateToUse.AddHours(offset); } - //use passed minute if specified + // use passed minute if specified if (_minuteSpecified) { offset = Minute - dateToUse.Minute; dateToUse = dateToUse.AddMinutes(offset); } - //use passed second if specified + // use passed second if specified if (_secondSpecified) { offset = Second - dateToUse.Second; dateToUse = dateToUse.AddSeconds(offset); } - //use passed millisecond if specified + // use passed millisecond if specified if (_millisecondSpecified) { offset = Millisecond - dateToUse.Millisecond; @@ -287,12 +287,12 @@ namespace Microsoft.PowerShell.Commands if (UFormat != null) { - //format according to UFormat string + // format according to UFormat string WriteObject(UFormatDateString(dateToUse)); } else if (Format != null) { - //format according to Format string + // format according to Format string // Special case built-in primitives: FileDate, FileDateTime. // These are the ISO 8601 "basic" formats, dropping dashes and colons @@ -321,7 +321,7 @@ namespace Microsoft.PowerShell.Commands } else { - //output DateTime object wrapped in an PSObject with DisplayHint attached + // output DateTime object wrapped in an PSObject with DisplayHint attached PSObject outputObj = new PSObject(dateToUse); PSNoteProperty note = new PSNoteProperty("DisplayHint", DisplayHint); outputObj.Properties.Add(note); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs index 221b4c946e..4ba3536118 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs @@ -164,7 +164,7 @@ namespace Microsoft.PowerShell.Commands } else { - //This is never used for display. It is used only as a key to typesAlreadyDisplayed + // This is never used for display. It is used only as a key to typesAlreadyDisplayed typeName = ""; } } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ObjectCommandComparer.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ObjectCommandComparer.cs index ddca8eb249..95aeeff24e 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ObjectCommandComparer.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ObjectCommandComparer.cs @@ -170,7 +170,7 @@ namespace Microsoft.PowerShell.Commands { return 1; } - //both are nonexisting + // both are nonexisting return 0; } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetDateCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetDateCommand.cs index 9ed207fa5c..1839834b1f 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetDateCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetDateCommand.cs @@ -100,7 +100,7 @@ namespace Microsoft.PowerShell.Commands #endif } - //output DateTime object wrapped in an PSObject with DisplayHint attached + // output DateTime object wrapped in an PSObject with DisplayHint attached PSObject outputObj = new PSObject(dateToUse); PSNoteProperty note = new PSNoteProperty("DisplayHint", DisplayHint); outputObj.Properties.Add(note); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs index 61130e1d65..91d3d07a72 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs @@ -58,14 +58,14 @@ namespace Microsoft.PowerShell.Commands #region methods - //Wait handle which is used by thread to sleep. + // Wait handle which is used by thread to sleep. private ManualResetEvent _waitHandle; - //object used for synchronizes pipeline thread and stop thread - //access to waitHandle + // object used for synchronizes pipeline thread and stop thread + // access to waitHandle private object _syncObject = new object(); - //this is set to true by stopProcessing + // this is set to true by stopProcessing private bool _stopping = false; /// diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs index 8bc9b34cf6..f05930881f 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/InvokeRestMethodCommand.Common.cs @@ -143,7 +143,7 @@ namespace Microsoft.PowerShell.Commands xrs.CheckCharacters = false; xrs.CloseInput = false; - //The XML data needs to be in conformance to the rules for a well-formed XML 1.0 document. + // The XML data needs to be in conformance to the rules for a well-formed XML 1.0 document. xrs.IgnoreProcessingInstructions = true; xrs.MaxCharactersFromEntities = 1024; xrs.DtdProcessing = DtdProcessing.Ignore; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs index 427adcf1f3..38c5ad61d2 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs @@ -1158,7 +1158,7 @@ namespace Microsoft.PowerShell.Commands if (ContentType != null) { WebSession.ContentHeaders[HttpKnownHeaderNames.ContentType] = ContentType; - //request + // request } // ContentType == null else if (Method == WebRequestMethod.Post || (IsCustomMethodSet() && CustomMethod.ToUpperInvariant() == "POST")) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs index 8d5061df17..15453bc7b5 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/XmlCommands.cs @@ -449,13 +449,13 @@ namespace Microsoft.PowerShell.Commands _serializer.DoneAsStream(); _serializer = null; } - //Loading to the XML Document + // Loading to the XML Document _ms.Position = 0; StreamReader read = new StreamReader(_ms); string data = read.ReadToEnd(); WriteObject(data); - //Cleanup + // Cleanup CleanUp(); } else @@ -481,7 +481,7 @@ namespace Microsoft.PowerShell.Commands } else { - //Loading to the XML Document + // Loading to the XML Document _ms.Position = 0; if (As.Equals("Document", StringComparison.OrdinalIgnoreCase)) { @@ -498,7 +498,7 @@ namespace Microsoft.PowerShell.Commands } } - //Cleaning up + // Cleaning up CleanUp(); } @@ -915,9 +915,9 @@ namespace Microsoft.PowerShell.Commands private void ProcessXmlFile(string filePath) { - //Cannot use ImportXMLHelper because it will throw terminating error which will - //not be inline with Select-String - //So doing self processing of the file. + // Cannot use ImportXMLHelper because it will throw terminating error which will + // not be inline with Select-String + // So doing self processing of the file. try { XmlDocument xmlDocument = InternalDeserializer.LoadUnsafeXmlDocument( @@ -1026,7 +1026,7 @@ namespace Microsoft.PowerShell.Commands (ParameterSetName.Equals("Path", StringComparison.OrdinalIgnoreCase) || (ParameterSetName.Equals("LiteralPath", StringComparison.OrdinalIgnoreCase)))) { - //If any file not resolved, execution stops. this is to make consistent with select-string. + // If any file not resolved, execution stops. this is to make consistent with select-string. List fullresolvedPaths = new List(); foreach (string fpath in Path) { @@ -1041,7 +1041,7 @@ namespace Microsoft.PowerShell.Commands Collection resolvedPaths = GetResolvedProviderPathFromPSPath(fpath, out provider); if (!provider.NameEquals(this.Context.ProviderNames.FileSystem)) { - //Cannot open File error + // Cannot open File error string message = StringUtil.Format(UtilityCommonStrings.FileOpenError, provider.FullName); InvalidOperationException e = new InvalidOperationException(message); ErrorRecord er = new ErrorRecord(e, "ProcessingFile", ErrorCategory.InvalidOperation, fpath); diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/convert-HTML.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/convert-HTML.cs index 41f21af8fb..c9068edbcd 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/convert-HTML.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/convert-HTML.cs @@ -428,7 +428,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void BeginProcessing() { - //ValidateNotNullOrEmpty attribute is not working for System.Uri datatype, so handling it here + // ValidateNotNullOrEmpty attribute is not working for System.Uri datatype, so handling it here if ((_cssuriSpecified) && (string.IsNullOrEmpty(_cssuri.OriginalString.Trim()))) { ArgumentException ex = new ArgumentException(StringUtil.Format(UtilityCommonStrings.EmptyCSSUri, "CSSUri")); @@ -578,12 +578,12 @@ namespace Microsoft.PowerShell.Commands StringBuilder Listtag = new StringBuilder(); Listtag.Append(""); - //for writing the property name + // for writing the property name WritePropertyName(Listtag, p); Listtag.Append(":"); Listtag.Append(""); - //for writing the property value + // for writing the property value Listtag.Append(""); WritePropertyValue(Listtag, p); Listtag.Append(""); @@ -597,7 +597,7 @@ namespace Microsoft.PowerShell.Commands /// private void WritePropertyName(StringBuilder Listtag, MshParameter p) { - //for writing the property name + // for writing the property name string label = p.GetEntry(ConvertHTMLParameterDefinitionKeys.LabelEntryKey) as string; if (label != null) { @@ -642,7 +642,7 @@ namespace Microsoft.PowerShell.Commands /// private void WriteTableHeader(StringBuilder THtag, List resolvedNameMshParameters) { - //write the property names + // write the property names foreach (MshParameter p in resolvedNameMshParameters) { THtag.Append(""); @@ -656,7 +656,7 @@ namespace Microsoft.PowerShell.Commands /// private void WriteTableRow(StringBuilder TRtag, List resolvedNameMshParameters) { - //write the property values + // write the property values foreach (MshParameter p in resolvedNameMshParameters) { TRtag.Append(""); @@ -665,7 +665,7 @@ namespace Microsoft.PowerShell.Commands } } - //count of the objects + // count of the objects private int _numberObjects = 0; /// @@ -689,21 +689,21 @@ namespace Microsoft.PowerShell.Commands return; } - //if the As parameter is given as List + // if the As parameter is given as List if (_as.Equals("List", StringComparison.OrdinalIgnoreCase)) { - //if more than one object,write the horizontal rule to put visual separator + // if more than one object,write the horizontal rule to put visual separator if (_numberObjects > 1) WriteObject("
"); WriteListEntry(); } - else //if the As parameter is Table, first we have to write the property names + else // if the As parameter is Table, first we have to write the property names { WriteColumns(_resolvedNameMshParameters); StringBuilder THtag = new StringBuilder(""); - //write the table header + // write the table header WriteTableHeader(THtag, _resolvedNameMshParameters); THtag.Append(""); @@ -711,12 +711,12 @@ namespace Microsoft.PowerShell.Commands _isTHWritten = true; } } - //if the As parameter is Table, write the property values + // if the As parameter is Table, write the property values if (_as.Equals("Table", StringComparison.OrdinalIgnoreCase)) { StringBuilder TRtag = new StringBuilder(""); - //write the table row + // write the table row WriteTableRow(TRtag, _resolvedNameMshParameters); TRtag.Append(""); @@ -728,12 +728,12 @@ namespace Microsoft.PowerShell.Commands ///
protected override void EndProcessing() { - //if fragment,end with table + // if fragment,end with table WriteObject(""); if (_postContent != null) WriteObject(_postContent, true); - //if not fragment end with body and html also + // if not fragment end with body and html also if (!_fragment) { WriteObject(""); @@ -749,7 +749,7 @@ namespace Microsoft.PowerShell.Commands private StringCollection _propertyCollector; private List _propertyMshParameterList; private List _resolvedNameMshParameters; - //private string ResourcesBaseName = "ConvertHTMLStrings"; + // private string ResourcesBaseName = "ConvertHTMLStrings"; #endregion private } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/new-object.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/new-object.cs index fff7e3041b..9ea4889dfe 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/new-object.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/new-object.cs @@ -194,7 +194,7 @@ namespace Microsoft.PowerShell.Commands } } - //WinRT does not support creating instances of attribute & delegate WinRT types. + // WinRT does not support creating instances of attribute & delegate WinRT types. if (WinRTHelper.IsWinRTType(type) && ((typeof(System.Attribute)).IsAssignableFrom(type) || (typeof(System.Delegate)).IsAssignableFrom(type))) { ThrowTerminatingError(new ErrorRecord(new InvalidOperationException(NewObjectStrings.CannotInstantiateWinRTType), @@ -455,7 +455,7 @@ namespace Microsoft.PowerShell.Commands } catch (COMException e) { - //Check Error Code to see if Error is because of Com apartment Mismatch. + // Check Error Code to see if Error is because of Com apartment Mismatch. if (e.HResult == RPC_E_CHANGED_MODE) { #if CORECLR diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/select-object.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/select-object.cs index 8f1fb53072..4828a6472f 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/select-object.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/select-object.cs @@ -256,7 +256,7 @@ namespace Microsoft.PowerShell.Commands public PSObject StreamingDequeue() { - //if skip parameter is not mentioned or there are no more objects to skip + // if skip parameter is not mentioned or there are no more objects to skip if (_skip == 0) { if (_skipLast > 0) @@ -286,7 +286,7 @@ namespace Microsoft.PowerShell.Commands } else { - //if last parameter is not mentioned,remove the objects and decrement the skip + // if last parameter is not mentioned,remove the objects and decrement the skip if (_last == 0) { Dequeue(); @@ -375,7 +375,7 @@ namespace Microsoft.PowerShell.Commands return; } - //If property parameter is mentioned + // If property parameter is mentioned List matchedProperties = new List(); foreach (MshParameter p in _propertyMshParameterList) { @@ -612,7 +612,7 @@ namespace Microsoft.PowerShell.Commands return; } - //if only unique is mentioned + // if only unique is mentioned else if ((_unique)) { bool isObjUnique = true; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceListenerCommandBase.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceListenerCommandBase.cs index af77b50c37..30d2d1677b 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceListenerCommandBase.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/TraceListenerCommandBase.cs @@ -294,7 +294,7 @@ namespace Microsoft.PowerShell.Commands // Save some disk write time by checking whether file is readonly.. if ((fInfo.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { - //Make sure the file is not read only + // Make sure the file is not read only fInfo.Attributes &= ~(FileAttributes.ReadOnly); } } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/update-list.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/update-list.cs index 282396fcac..addfcf7c59 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/update-list.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/update-list.cs @@ -52,8 +52,8 @@ namespace Microsoft.PowerShell.Commands /// The following is the definition of the input parameter "InputObject". /// List of InputObjects where the updates needs to applied to the specific property. ///
- //[Parameter(ValueFromPipeline = true, ParameterSetName = "AddRemoveSet")] - //[Parameter(ValueFromPipeline = true, ParameterSetName = "ReplaceSet")] + // [Parameter(ValueFromPipeline = true, ParameterSetName = "AddRemoveSet")] + // [Parameter(ValueFromPipeline = true, ParameterSetName = "ReplaceSet")] [Parameter(ValueFromPipeline = true)] [ValidateNotNullOrEmpty()] public PSObject InputObject { get; set; } @@ -62,8 +62,8 @@ namespace Microsoft.PowerShell.Commands /// The following is the definition of the input parameter "Property". /// Defines which property of the input object should be updated with Add and Remove actions. ///
- //[Parameter(Position = 0, ParameterSetName = "AddRemoveSet")] - //[Parameter(Position = 0, ParameterSetName = "ReplaceSet")] + // [Parameter(Position = 0, ParameterSetName = "AddRemoveSet")] + // [Parameter(Position = 0, ParameterSetName = "ReplaceSet")] [Parameter(Position = 0)] [ValidateNotNullOrEmpty()] public string Property { get; set; } diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs index 32f74043a5..177fc5d810 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs @@ -199,7 +199,7 @@ namespace Microsoft.PowerShell [StructLayout(LayoutKind.Sequential)] internal struct FONTSIGNATURE { - //From public\sdk\inc\wingdi.h + // From public\sdk\inc\wingdi.h // fsUsb*: A 128-bit Unicode subset bitfield (USB) identifying up to 126 Unicode subranges internal DWORD fsUsb0; @@ -214,7 +214,7 @@ namespace Microsoft.PowerShell [StructLayout(LayoutKind.Sequential)] internal struct CHARSETINFO { - //From public\sdk\inc\wingdi.h + // From public\sdk\inc\wingdi.h internal uint ciCharset; // Character set value. internal uint ciACP; // ANSI code-page identifier. internal FONTSIGNATURE fs; @@ -223,7 +223,7 @@ namespace Microsoft.PowerShell [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] internal struct TEXTMETRIC { - //From public\sdk\inc\wingdi.h + // From public\sdk\inc\wingdi.h public int tmHeight; public int tmAscent; public int tmDescent; @@ -1091,11 +1091,11 @@ namespace Microsoft.PowerShell screenRegion.Bottom - screenRegion.Top; #if DEBUG - //Check contents in contentsRegion + // Check contents in contentsRegion CheckWriteConsoleOutputContents(contents, contentsRegion); #endif - //Identify edges and areas of identical contiguous edges in contentsRegion + // Identify edges and areas of identical contiguous edges in contentsRegion List sameEdgeAreas = new List(); int firstLeftTrailingRow = -1, firstRightLeadingRow = -1; BuildEdgeTypeInfo(contentsRegion, contents, @@ -1262,7 +1262,7 @@ namespace Microsoft.PowerShell } } } - //Check right edge + // Check right edge if (origin.X + (contentsRegion.Right - contentsRegion.Left) + 1 >= bufferInfo.BufferSize.X) { if (firstRightLeadingRow >= 0) diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs index 9d0d3f78c5..41b4797dae 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs @@ -286,7 +286,7 @@ namespace Microsoft.PowerShell case ConsoleSpecialKey.ControlBreak: if (s_cpp.NonInteractive) { - //ControlBreak mimics ControlC in Noninteractive shells + // ControlBreak mimics ControlC in Noninteractive shells SpinUpBreakHandlerThread(shouldEndSession: true); } else @@ -311,7 +311,7 @@ namespace Microsoft.PowerShell case ConsoleControl.ConsoleBreakSignal.CtrlBreak: if (s_cpp.NonInteractive) { - //ControlBreak mimics ControlC in Noninteractive shells + // ControlBreak mimics ControlC in Noninteractive shells SpinUpBreakHandlerThread(shouldEndSession: true); } else diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs index 215ae27caf..df66ecf0c4 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs @@ -1621,15 +1621,15 @@ namespace Microsoft.PowerShell public override void SetBufferContents(Coordinates origin, BufferCell[,] contents) { - //if there are no contents, there is nothing to set the buffer to + // if there are no contents, there is nothing to set the buffer to if (contents == null) { PSTraceSource.NewArgumentNullException("contents"); } - //if the cursor is on the last line, we need to make more space to print the specified buffer + // if the cursor is on the last line, we need to make more space to print the specified buffer if (origin.Y == BufferSize.Height - 1 && origin.X >= BufferSize.Width) { - //for each row in the buffer, create a new line + // for each row in the buffer, create a new line int rows = contents.GetLength(0); ScrollBuffer(rows); // for each row in the buffer, move the cursor y up to the beginning of the created blank space @@ -1648,25 +1648,25 @@ namespace Microsoft.PowerShell CursorPosition = origin; #endif - //iterate through the buffer to set + // iterate through the buffer to set foreach (var charitem in contents) { - //set the cursor to false to prevent cursor flicker + // set the cursor to false to prevent cursor flicker Console.CursorVisible = false; - //if x is exceeding buffer width, reset to the next line + // if x is exceeding buffer width, reset to the next line if (origin.X >= BufferSize.Width) { origin.X = 0; } - //write the character from contents + // write the character from contents Console.Out.Write(charitem.Character); } - //reset the cursor to the original position + // reset the cursor to the original position CursorPosition = origin; - //reset the cursor to visible + // reset the cursor to visible Console.CursorVisible = true; } diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs index 54aa54a7bf..b0e45fa235 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs @@ -106,10 +106,10 @@ namespace Microsoft.PowerShell ///// ///// - //internal - //PSHost - //Parent - //{ + // internal + // PSHost + // Parent + // { // get // { // using (tracer.TraceProperty()) @@ -119,7 +119,7 @@ namespace Microsoft.PowerShell // return parent; // } // } - //} + // } /// /// true if command completion is currently running. @@ -1077,7 +1077,7 @@ namespace Microsoft.PowerShell bool unused; message = HostUtilities.RemoveGuidFromMessage(message, out unused); - //We should write debug to error stream only if debug is redirected.) + // We should write debug to error stream only if debug is redirected.) if (_parent.ErrorFormat == Serialization.DataFormat.XML) { _parent.ErrorSerializer.Serialize(message, "debug"); @@ -1098,7 +1098,7 @@ namespace Microsoft.PowerShell /// public override void WriteInformation(InformationRecord record) { - //We should write information to error stream only if redirected.) + // We should write information to error stream only if redirected.) if (_parent.ErrorFormat == Serialization.DataFormat.XML) { _parent.ErrorSerializer.Serialize(record, "information"); @@ -2058,8 +2058,8 @@ namespace Microsoft.PowerShell private object _instanceLock = new object(); - //If this is true, class throws on read or prompt method which require - //access to console. + // If this is true, class throws on read or prompt method which require + // access to console. internal bool ThrowOnReadAndPrompt { set diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs index 8f09238b65..e9790f895e 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/Executor.cs @@ -114,8 +114,8 @@ namespace Microsoft.PowerShell if (cer != null) { er = cer.ErrorRecord; - //Exception inside the error record is ParentContainsErrorRecordException which - //doesn't have stack trace. Replace it with top level exception. + // Exception inside the error record is ParentContainsErrorRecordException which + // doesn't have stack trace. Replace it with top level exception. er = new ErrorRecord(er, ex); } @@ -235,10 +235,10 @@ namespace Microsoft.PowerShell } catch (PipelineClosedException) { - //This exception can occurs when input is closed. This can happen - //for various reasons. For ex:Command in the pipeline is invalid and - //command discovery throws exception which closes the pipeline and - //hence the Input pipe. + // This exception can occurs when input is closed. This can happen + // for various reasons. For ex:Command in the pipeline is invalid and + // command discovery throws exception which closes the pipeline and + // hence the Input pipe. break; } }; @@ -249,17 +249,17 @@ namespace Microsoft.PowerShell pipelineWaiter.Wait(); - //report error if pipeline failed + // report error if pipeline failed if (tempPipeline.PipelineStateInfo.State == PipelineState.Failed && tempPipeline.PipelineStateInfo.Reason != null) { if (_parent.OutputFormat == Serialization.DataFormat.Text) { - //Report the exception using normal error reporting + // Report the exception using normal error reporting exceptionThrown = tempPipeline.PipelineStateInfo.Reason; } else { - //serialize the error record + // serialize the error record AsyncPipelineFailureHandler(tempPipeline.PipelineStateInfo.Reason); } } diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs index 7323fb256a..e2f1bfeb85 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ProgressPane.cs @@ -87,7 +87,7 @@ namespace Microsoft.PowerShell _rawui.CursorPosition = _location; } - //if the cursor is at the bottom, create screen buffer space by scrolling + // if the cursor is at the bottom, create screen buffer space by scrolling int scrollRows = rows - ((_rawui.BufferSize.Height - 1) - _location.Y); if (scrollRows > 0) { @@ -104,7 +104,7 @@ namespace Microsoft.PowerShell _savedCursor.Y -= scrollRows; } - //create cleared region to clear progress bar later + // create cleared region to clear progress bar later _savedRegion = tempProgressRegion; for(int row = 0; row < rows; row++) { @@ -114,7 +114,7 @@ namespace Microsoft.PowerShell } } - //put cursor back to where output should be + // put cursor back to where output should be _rawui.CursorPosition = _location; #else _location = _rawui.WindowPosition; diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/StartTranscriptCmdlet.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/StartTranscriptCmdlet.cs index 991f0ef280..15d77ba0a3 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/StartTranscriptCmdlet.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/StartTranscriptCmdlet.cs @@ -214,7 +214,7 @@ namespace Microsoft.PowerShell.Commands // Save some disk write time by checking whether file is readonly.. if (Force) { - //Make sure the file is not read only + // Make sure the file is not read only // Note that we will not clear the ReadOnly flag later fInfo.Attributes &= ~(FileAttributes.ReadOnly); } diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs index 39c1c1b4b3..61fcc992fe 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/EventProvider.cs @@ -37,7 +37,7 @@ namespace System.Diagnostics.Eventing [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] public enum WriteEventErrorCode : int { - //check mapping to runtime codes + // check mapping to runtime codes NoError = 0, NoFreeBuffers = 1, EventTooBig = 2 @@ -413,7 +413,7 @@ namespace System.Diagnostics.Eventing } else { - //To our eyes, everything else is a just a string + // To our eyes, everything else is a just a string sRet = data.ToString(); dataDescriptor->Size = (uint)((sRet.Length + 1) * 2); return sRet; @@ -624,7 +624,7 @@ namespace System.Diagnostics.Eventing if (argCount > s_etwMaxNumberArguments) { // - //too many arguments to log + // too many arguments to log // throw new ArgumentOutOfRangeException("eventPayload", string.Format(CultureInfo.CurrentCulture, DotNetEventingStrings.ArgumentOutOfRange_MaxArgExceeded, s_etwMaxNumberArguments)); @@ -633,7 +633,7 @@ namespace System.Diagnostics.Eventing uint totalEventSize = 0; int index; int stringIndex = 0; - int[] stringPosition = new int[s_etwAPIMaxStringCount]; //used to keep the position of strings in the eventPayload parameter + int[] stringPosition = new int[s_etwAPIMaxStringCount]; // used to keep the position of strings in the eventPayload parameter string[] dataString = new string[s_etwAPIMaxStringCount]; // string arrays from the eventPayload parameter EventData* userData = stackalloc EventData[argCount]; // allocation for the data descriptors userDataPtr = (EventData*)userData; diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventKeyword.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventKeyword.cs index 3d7c298d82..bc4d3c701a 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventKeyword.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventKeyword.cs @@ -28,7 +28,7 @@ namespace System.Diagnostics.Eventing.Reader private ProviderMetadata _pmReference; private object _syncObject; - //called from EventMetadata + // called from EventMetadata internal EventKeyword(long value, ProviderMetadata pmReference) { _value = value; @@ -36,7 +36,7 @@ namespace System.Diagnostics.Eventing.Reader _syncObject = new object(); } - //called from ProviderMetadata + // called from ProviderMetadata internal EventKeyword(string name, long value, string displayName) { _value = value; diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLevel.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLevel.cs index bac4f8db58..795891e1fa 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLevel.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLevel.cs @@ -28,7 +28,7 @@ namespace System.Diagnostics.Eventing.Reader private ProviderMetadata _pmReference; private object _syncObject; - //called from EventMetadata + // called from EventMetadata internal EventLevel(int value, ProviderMetadata pmReference) { _value = value; @@ -36,7 +36,7 @@ namespace System.Diagnostics.Eventing.Reader _syncObject = new object(); } - //called from ProviderMetadata + // called from ProviderMetadata internal EventLevel(string name, int value, string displayName) { _value = value; diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogReader.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogReader.cs index ec6f4399db..ef1e27929e 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogReader.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogReader.cs @@ -81,10 +81,10 @@ namespace System.Diagnostics.Eventing.Reader _cachedMetadataInformation = new ProviderMetadataCachedInformation(eventQuery.Session, logfile, 50); - //explicit data + // explicit data _eventQuery = eventQuery; - //implicit + // implicit _batchSize = 64; _eventsBuffer = new IntPtr[_batchSize]; @@ -153,7 +153,7 @@ namespace System.Diagnostics.Eventing.Reader { _eventCount = 0; _currentIndex = 0; - return false; //no more events in the result set + return false; // no more events in the result set } _currentIndex = 0; @@ -214,7 +214,7 @@ namespace System.Diagnostics.Eventing.Reader internal void SeekReset() { // - //close all unread event handles in the buffer + // close all unread event handles in the buffer // while (_currentIndex < _eventCount) { @@ -222,7 +222,7 @@ namespace System.Diagnostics.Eventing.Reader _currentIndex++; } - //reset the indexes used by Next + // reset the indexes used by Next _currentIndex = 0; _eventCount = 0; _isEof = false; @@ -282,7 +282,7 @@ namespace System.Diagnostics.Eventing.Reader case SeekOrigin.Current: if (offset >= 0) { - //we can reuse elements in the batch. + // we can reuse elements in the batch. if (_currentIndex + offset < _eventCount) { // @@ -298,8 +298,8 @@ namespace System.Diagnostics.Eventing.Reader } _currentIndex = (int)(_currentIndex + offset); - //leave the eventCount unchanged - //leave the same Eof + // leave the eventCount unchanged + // leave the same Eof } else { diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogRecord.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogRecord.cs index bc8a2541d4..f91640d5e6 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogRecord.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogRecord.cs @@ -32,16 +32,16 @@ namespace System.Diagnostics.Eventing.Reader private string _containerChannel; private int[] _matchedQueryIds; - //a dummy object which is used only for the locking. + // a dummy object which is used only for the locking. private object _syncObject; - //cached DisplayNames for each instance + // cached DisplayNames for each instance private string _levelName = null; private string _taskName = null; private string _opcodeName = null; private IEnumerable _keywordsNames = null; - //cached DisplayNames for each instance + // cached DisplayNames for each instance private bool _levelNameReady; private bool _taskNameReady; private bool _opcodeNameReady; @@ -75,7 +75,7 @@ namespace System.Diagnostics.Eventing.Reader if (_systemProperties.filled) return; - //prepare the System Context, if it is not already initialized. + // prepare the System Context, if it is not already initialized. _session.SetupSystemContext(); lock (_syncObject) @@ -310,7 +310,7 @@ namespace System.Diagnostics.Eventing.Reader { if (values == null) return this.FormatDescription(); - //copy the value IEnumerable to an array. + // copy the value IEnumerable to an array. string[] theValues = new string[0]; int i = 0; foreach (object o in values) diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogSession.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogSession.cs index d7f5fb0c8e..b2b634321e 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogSession.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventLogSession.cs @@ -39,30 +39,30 @@ namespace System.Diagnostics.Eventing.Reader public class EventLogSession : IDisposable { // - //the two context handles for rendering (for EventLogRecord). - //the system and user context handles. They are both common for all the event instances and can be created only once. - //access to the data member references is safe, while - //invoking methods on it is marked SecurityCritical as appropriate. + // the two context handles for rendering (for EventLogRecord). + // the system and user context handles. They are both common for all the event instances and can be created only once. + // access to the data member references is safe, while + // invoking methods on it is marked SecurityCritical as appropriate. // internal EventLogHandle renderContextHandleSystem = EventLogHandle.Zero; internal EventLogHandle renderContextHandleUser = EventLogHandle.Zero; - //the dummy sync object for the two contexts. + // the dummy sync object for the two contexts. private object _syncObject = null; private string _server; private string _user; private string _domain; private SessionAuthentication _logOnType; - //we do not maintain the password here. + // we do not maintain the password here. // - //access to the data member references is safe, while - //invoking methods on it is marked SecurityCritical as appropriate. + // access to the data member references is safe, while + // invoking methods on it is marked SecurityCritical as appropriate. // private EventLogHandle _handle = EventLogHandle.Zero; - //setup the System Context, once for all the EventRecords. + // setup the System Context, once for all the EventRecords. [System.Security.SecuritySafeCritical] internal void SetupSystemContext() { @@ -72,8 +72,8 @@ namespace System.Diagnostics.Eventing.Reader { if (this.renderContextHandleSystem.IsInvalid) { - //create the SYSTEM render context - //call the EvtCreateRenderContext to get the renderContextHandleSystem, so that we can get the system/values/user properties. + // create the SYSTEM render context + // call the EvtCreateRenderContext to get the renderContextHandleSystem, so that we can get the system/values/user properties. this.renderContextHandleSystem = NativeWrapper.EvtCreateRenderContext(0, null, UnsafeNativeMethods.EvtRenderContextFlags.EvtRenderContextSystem); } } @@ -86,7 +86,7 @@ namespace System.Diagnostics.Eventing.Reader { if (this.renderContextHandleUser.IsInvalid) { - //create the USER render context + // create the USER render context this.renderContextHandleUser = NativeWrapper.EvtCreateRenderContext(0, null, UnsafeNativeMethods.EvtRenderContextFlags.EvtRenderContextUser); } } @@ -97,7 +97,7 @@ namespace System.Diagnostics.Eventing.Reader [System.Security.SecurityCritical] public EventLogSession() { - //handle = EventLogHandle.Zero; + // handle = EventLogHandle.Zero; _syncObject = new object(); } @@ -132,7 +132,7 @@ namespace System.Diagnostics.Eventing.Reader { if (password != null) erLogin.Password.SetMemory(SecureStringMarshal.SecureStringToCoTaskMemUnicode(password)); - //open a session using the erLogin structure. + // open a session using the erLogin structure. _handle = NativeWrapper.EvtOpenSession(UnsafeNativeMethods.EvtLoginClass.EvtRpcLogin, ref erLogin, 0, 0); } finally diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventMetadata.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventMetadata.cs index 5efede7668..ddbfaa49a8 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventMetadata.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventMetadata.cs @@ -116,18 +116,18 @@ namespace System.Diagnostics.Eventing.Reader ulong theKeywords = unchecked((ulong)_keywords); ulong mask = 0x8000000000000000; - //for every bit - //for (int i = 0; i < 64 && theKeywords != 0; i++) + // for every bit + // for (int i = 0; i < 64 && theKeywords != 0; i++) for (int i = 0; i < 64; i++) { - //if this bit is set + // if this bit is set if ((theKeywords & mask) > 0) { - //the mask is the keyword we will be searching for. + // the mask is the keyword we will be searching for. list.Add(new EventKeyword(unchecked((long)mask), _pmReference)); - //theKeywords = theKeywords - mask; + // theKeywords = theKeywords - mask; } - //modify the mask to check next bit. + // modify the mask to check next bit. mask = mask >> 1; } diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventOpcode.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventOpcode.cs index 64c35238bf..b460dbba8a 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventOpcode.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventOpcode.cs @@ -26,7 +26,7 @@ namespace System.Diagnostics.Eventing.Reader private ProviderMetadata _pmReference; private object _syncObject; - //call from EventMetadata + // call from EventMetadata internal EventOpcode(int value, ProviderMetadata pmReference) { _value = value; @@ -34,7 +34,7 @@ namespace System.Diagnostics.Eventing.Reader _syncObject = new object(); } - //call from ProviderMetadata + // call from ProviderMetadata internal EventOpcode(string name, int value, string displayName) { _value = value; @@ -52,7 +52,7 @@ namespace System.Diagnostics.Eventing.Reader // get the data IEnumerable result = _pmReference.Opcodes; - //set the names and display names to null + // set the names and display names to null _name = null; _displayName = null; _dataReady = true; @@ -67,7 +67,7 @@ namespace System.Diagnostics.Eventing.Reader } } } - }//End Prepare Data + } public string Name { diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventTask.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventTask.cs index 1d9e173257..622a1290b9 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventTask.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/EventTask.cs @@ -29,7 +29,7 @@ namespace System.Diagnostics.Eventing.Reader private ProviderMetadata _pmReference; private object _syncObject; - //called from EventMetadata + // called from EventMetadata internal EventTask(int value, ProviderMetadata pmReference) { _value = value; @@ -37,7 +37,7 @@ namespace System.Diagnostics.Eventing.Reader _syncObject = new object(); } - //called from ProviderMetadata + // called from ProviderMetadata internal EventTask(string name, int value, string displayName, Guid guid) { _value = value; diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs index 0212bb8d04..2f8b2f6731 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/NativeWrapper.cs @@ -25,7 +25,7 @@ namespace System.Diagnostics.Eventing.Reader { public class SystemProperties { - //indicates if the SystemProperties values were already computed (for this event Instance, surely). + // indicates if the SystemProperties values were already computed (for this event Instance, surely). public bool filled = false; public ushort? Id = null; @@ -296,7 +296,7 @@ namespace System.Diagnostics.Eventing.Reader { if (win32Error == UnsafeNativeMethods.ERROR_INSUFFICIENT_BUFFER) { - //reallocate the new RenderBuffer with the right size. + // reallocate the new RenderBuffer with the right size. buffer.Capacity = buffUsed; status = UnsafeNativeMethods.EvtRender(context, eventHandle, flags, buffer.Capacity, buffer, out buffUsed, out propCount); win32Error = Marshal.GetLastWin32Error(); @@ -839,7 +839,7 @@ namespace System.Diagnostics.Eventing.Reader throw new InvalidOperationException("We do not have " + SYSTEM_PROPERTY_COUNT + " variants given for the UnsafeNativeMethods.EvtRenderFlags.EvtRenderEventValues flag. (System Properties)"); pointer = buffer; - //read each Variant structure + // read each Variant structure for (int i = 0; i < propCount; i++) { UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure(pointer); @@ -911,8 +911,8 @@ namespace System.Diagnostics.Eventing.Reader } } - //EvtRenderContextFlags can be both: EvtRenderContextFlags.EvtRenderContextUser and EvtRenderContextFlags.EvtRenderContextValues - //Render with Context = ContextUser or ContextValues (with user defined Xpath query strings) + // EvtRenderContextFlags can be both: EvtRenderContextFlags.EvtRenderContextUser and EvtRenderContextFlags.EvtRenderContextValues + // Render with Context = ContextUser or ContextValues (with user defined Xpath query strings) [System.Security.SecuritySafeCritical] public static IList EvtRenderBufferWithContextUserOrValues(EventLogHandle contextHandle, EventLogHandle eventHandle) { @@ -1012,7 +1012,7 @@ namespace System.Diagnostics.Eventing.Reader return sb.ToString(); } - //The EvtFormatMessage used for the obtaining of the Keywords names. + // The EvtFormatMessage used for the obtaining of the Keywords names. [System.Security.SecuritySafeCritical] public static IEnumerable EvtFormatMessageRenderKeywords(EventLogHandle pmHandle, EventLogHandle eventHandle, UnsafeNativeMethods.EvtFormatMessageFlags flag) { @@ -1067,7 +1067,7 @@ namespace System.Diagnostics.Eventing.Reader if (string.IsNullOrEmpty(s)) break; keywordsList.Add(s); - //nr of bytes = # chars * 2 + 2 bytes for character '\0'. + // nr of bytes = # chars * 2 + 2 bytes for character '\0'. pointer = new IntPtr((Int64)pointer + (s.Length * 2) + 2); } @@ -1113,7 +1113,7 @@ namespace System.Diagnostics.Eventing.Reader } } - //Get the formatted description, using the msgId for FormatDescription(string []) + // Get the formatted description, using the msgId for FormatDescription(string []) [System.Security.SecuritySafeCritical] public static string EvtFormatMessageFormatDescription(EventLogHandle handle, EventLogHandle eventHandle, string[] values) { @@ -1278,9 +1278,9 @@ namespace System.Diagnostics.Eventing.Reader return ConvertToFileTimeArray(val); case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeSysTime): return ConvertToSysTimeArray(val); - case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeBinary): //both length and count in the manifest: tracrpt supports, Crimson APIs don't - case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeSizeT): //unused: array of win:pointer is returned as HexIntXX - case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeSid): //unsupported by native APIs + case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeBinary): // both length and count in the manifest: tracrpt supports, Crimson APIs don't + case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeSizeT): // unused: array of win:pointer is returned as HexIntXX + case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeSid): // unsupported by native APIs default: throw new EventLogInvalidDataException(); } @@ -1347,7 +1347,7 @@ namespace System.Diagnostics.Eventing.Reader [System.Security.SecurityCritical] public static Array ConvertToBoolArray(UnsafeNativeMethods.EvtVariant val) { - //NOTE: booleans are padded to 4 bytes in ETW + // NOTE: booleans are padded to 4 bytes in ETW IntPtr ptr = val.Reference; if (ptr == IntPtr.Zero) { diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadata.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadata.cs index 8d495decc3..43ec555a97 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadata.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadata.cs @@ -38,8 +38,8 @@ namespace System.Diagnostics.Eventing.Reader private CultureInfo _cultureInfo; private string _logFilePath; - //caching of the IEnumerable, , , on the ProviderMetadata - //they do not change with every call. + // caching of the IEnumerable, , , on the ProviderMetadata + // they do not change with every call. private IList _levels = null; private IList _opcodes = null; private IList _tasks = null; @@ -195,7 +195,7 @@ namespace System.Diagnostics.Eventing.Reader int channelRefMessageId = unchecked((int)((uint)NativeWrapper.EvtGetObjectArrayProperty(elHandle, index, (int)UnsafeNativeMethods.EvtPublisherMetadataPropertyId.EvtPublisherMetadataChannelReferenceMessageID))); string channelRefDisplayName; - //if channelRefMessageId == -1, we do not have anything in the message table. + // if channelRefMessageId == -1, we do not have anything in the message table. if (channelRefMessageId == -1) { channelRefDisplayName = null; diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadataCachedInformation.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadataCachedInformation.cs index 9a08c69c00..238dc13df8 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadataCachedInformation.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/Reader/ProviderMetadataCachedInformation.cs @@ -149,13 +149,13 @@ namespace System.Diagnostics.Eventing.Reader DateTime timeNow = DateTime.Now; ProviderMetadataId keyToDelete = null; - //get the entry in the cache which was not accessed for the longest time. + // get the entry in the cache which was not accessed for the longest time. foreach (KeyValuePair kvp in _cache) { - //the time difference (in ms) between the timeNow and the last used time of each entry + // the time difference (in ms) between the timeNow and the last used time of each entry TimeSpan timeDifference = timeNow.Subtract(kvp.Value.TheTime); - //for the "unused" items (with ReferenceCount == 0) -> can possible be deleted. + // for the "unused" items (with ReferenceCount == 0) -> can possible be deleted. if (timeDifference.TotalMilliseconds >= maxPassedTime) { maxPassedTime = timeDifference.TotalMilliseconds; @@ -309,4 +309,4 @@ namespace System.Diagnostics.Eventing.Reader } } } -} \ No newline at end of file +} diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/UnsafeNativeMethods.cs b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/UnsafeNativeMethods.cs index 8811cda708..25ba372091 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/UnsafeNativeMethods.cs +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/UnsafeNativeMethods.cs @@ -244,7 +244,7 @@ namespace System.Diagnostics.Eventing // these types used internally EvtVarTypeEvtHandle = 32, EvtVarTypeEvtXml = 35, - //Array = 128 + // Array = 128 EvtVarTypeStringArray = 129, EvtVarTypeUInt32Array = 136 } @@ -341,8 +341,8 @@ namespace System.Diagnostics.Eventing /// internal enum EvtQueryPropertyId { - EvtQueryNames = 0, //String; //Variant will be array of EvtVarTypeString - EvtQueryStatuses = 1 //UInt32; //Variant will be Array of EvtVarTypeUInt32 + EvtQueryNames = 0, // String; // Variant will be array of EvtVarTypeString + EvtQueryStatuses = 1 // UInt32; // Variant will be Array of EvtVarTypeUInt32 } /// @@ -384,7 +384,7 @@ namespace System.Diagnostics.Eventing EvtPublisherMetadataKeywordName = 26, // EvtVarTypeString EvtPublisherMetadataKeywordValue = 27, // EvtVarTypeUInt64 EvtPublisherMetadataKeywordMessageID = 28//, // EvtVarTypeUInt32 - //EvtPublisherMetadataPropertyIdEND + // EvtPublisherMetadataPropertyIdEND } internal enum EvtChannelReferenceFlags @@ -403,10 +403,10 @@ namespace System.Diagnostics.Eventing EventMetadataEventKeyword, // EvtVarTypeUInt64 EventMetadataEventMessageID,// EvtVarTypeUInt32 EventMetadataEventTemplate // EvtVarTypeString - //EvtEventMetadataPropertyIdEND + // EvtEventMetadataPropertyIdEND } - //CHANNEL CONFIGURATION + // CHANNEL CONFIGURATION internal enum EvtChannelConfigPropertyId { EvtChannelConfigEnabled = 0, // EvtVarTypeBoolean @@ -432,7 +432,7 @@ namespace System.Diagnostics.Eventing EvtChannelConfigPropertyIdEND } - //LOG INFORMATION + // LOG INFORMATION internal enum EvtLogPropertyId { EvtLogCreationTime = 0, // EvtVarTypeFileTime @@ -452,7 +452,7 @@ namespace System.Diagnostics.Eventing EvtExportLogTolerateQueryErrors = 0x1000 } - //RENDERING + // RENDERING internal enum EvtRenderContextFlags { EvtRenderContextValues = 0, // Render specific properties @@ -503,7 +503,7 @@ namespace System.Diagnostics.Eventing EvtSystemPropertyIdEND } - //SESSION + // SESSION internal enum EvtLoginClass { EvtRpcLogin = 1 @@ -523,7 +523,7 @@ namespace System.Diagnostics.Eventing public int Flags; } - //SEEK + // SEEK [Flags] internal enum EvtSeekFlags { @@ -543,7 +543,7 @@ namespace System.Diagnostics.Eventing [MarshalAs(UnmanagedType.LPWStr)]string query, int flags); - //SEEK + // SEEK [DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)] [SecurityCritical] [return: MarshalAs(UnmanagedType.Bool)] @@ -588,7 +588,7 @@ namespace System.Diagnostics.Eventing [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool EvtGetEventInfo( EventLogHandle eventHandle, - //int propertyId + // int propertyId [MarshalAs(UnmanagedType.I4)]EvtEventPropertyId propertyId, int bufferSize, IntPtr bufferPtr, @@ -606,7 +606,7 @@ namespace System.Diagnostics.Eventing ref int bufferRequired ); - //PUBLISHER METADATA + // PUBLISHER METADATA [DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)] [SecurityCritical] internal static extern EventLogHandle EvtOpenPublisherMetadata( @@ -629,7 +629,7 @@ namespace System.Diagnostics.Eventing out int publisherMetadataPropertyBufferUsed ); - //NEW + // NEW [DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)] [SecurityCritical] @@ -652,7 +652,7 @@ namespace System.Diagnostics.Eventing out int propertyValueBufferUsed ); - //NEW 2 + // NEW 2 [DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)] [SecurityCritical] internal static extern EventLogHandle EvtOpenEventMetadataEnum( @@ -662,7 +662,7 @@ namespace System.Diagnostics.Eventing [DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)] [SecurityCritical] - //public static extern IntPtr EvtNextEventMetadata( + // public static extern IntPtr EvtNextEventMetadata( internal static extern EventLogHandle EvtNextEventMetadata( EventLogHandle eventMetadataEnum, int flags @@ -680,7 +680,7 @@ namespace System.Diagnostics.Eventing out int eventMetadataPropertyBufferUsed ); - //Channel Configuration Native Api + // Channel Configuration Native Api [DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)] [SecurityCritical] @@ -695,7 +695,7 @@ namespace System.Diagnostics.Eventing internal static extern bool EvtNextChannelPath( EventLogHandle channelEnum, int channelPathBufferSize, - //StringBuilder channelPathBuffer, + // StringBuilder channelPathBuffer, [Out, MarshalAs(UnmanagedType.LPWStr)]StringBuilder channelPathBuffer, out int channelPathBufferUsed ); @@ -755,7 +755,7 @@ namespace System.Diagnostics.Eventing out int propertyValueBufferUsed ); - //Log Information Native Api + // Log Information Native Api [DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)] [SecurityCritical] @@ -776,7 +776,7 @@ namespace System.Diagnostics.Eventing out int propertyValueBufferUsed ); - //LOG MANIPULATION + // LOG MANIPULATION [DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)] [SecurityCritical] @@ -809,7 +809,7 @@ namespace System.Diagnostics.Eventing int flags ); - //RENDERING + // RENDERING [DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)] [SecurityCritical] internal static extern EventLogHandle EvtCreateRenderContext( @@ -886,7 +886,7 @@ namespace System.Diagnostics.Eventing out int bufferUsed ); - //SESSION + // SESSION [DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)] [SecurityCritical] internal static extern EventLogHandle EvtOpenSession( @@ -896,7 +896,7 @@ namespace System.Diagnostics.Eventing int flags ); - //BOOKMARK + // BOOKMARK [DllImport(WEVTAPI, EntryPoint = "EvtCreateBookmark", CharSet = CharSet.Unicode, SetLastError = true)] [SecurityCritical] internal static extern EventLogHandle EvtCreateBookmark( diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/AddLocalGroupMemberCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/AddLocalGroupMemberCommand.cs index bb11310650..d799a70d9d 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/AddLocalGroupMemberCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/AddLocalGroupMemberCommand.cs @@ -298,7 +298,7 @@ namespace Microsoft.PowerShell.Commands } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/DisableLocalUserCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/DisableLocalUserCommand.cs index 84e1ce6281..5125f28c88 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/DisableLocalUserCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/DisableLocalUserCommand.cs @@ -214,7 +214,7 @@ namespace Microsoft.PowerShell.Commands return ShouldProcess(target, Strings.ActionDisableUser); } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/EnableLocalUserCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/EnableLocalUserCommand.cs index e2f6829338..60f7f21c3f 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/EnableLocalUserCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/EnableLocalUserCommand.cs @@ -214,7 +214,7 @@ namespace Microsoft.PowerShell.Commands return ShouldProcess(target, Strings.ActionEnableUser); } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalGroupCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalGroupCommand.cs index 795fa2a89a..74836e1aa1 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalGroupCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalGroupCommand.cs @@ -165,7 +165,7 @@ namespace Microsoft.PowerShell.Commands } } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalGroupMemberCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalGroupMemberCommand.cs index 306cebba95..e3853d73cc 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalGroupMemberCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalGroupMemberCommand.cs @@ -157,12 +157,12 @@ namespace Microsoft.PowerShell.Commands // if no members are specified, return all of them if (Member == null) { - //return membership; + // return membership; rv = new List(membership); } else { - //var rv = new List(); + // var rv = new List(); rv = new List(); if (WildcardPattern.ContainsWildcardCharacters(Member)) @@ -230,7 +230,7 @@ namespace Microsoft.PowerShell.Commands return ProcessesMembership(sam.GetLocalGroupMembers(groupSid)); } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalUserCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalUserCommand.cs index 230cca1de1..f25791df48 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalUserCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/GetLocalUserCommand.cs @@ -167,7 +167,7 @@ namespace Microsoft.PowerShell.Commands } } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/NewLocalGroupCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/NewLocalGroupCommand.cs index 180857e7e2..2c2f28d617 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/NewLocalGroupCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/NewLocalGroupCommand.cs @@ -115,7 +115,7 @@ namespace Microsoft.PowerShell.Commands return ShouldProcess(target, Strings.ActionNewGroup); } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/NewLocalUserCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/NewLocalUserCommand.cs index de871df89b..a5d012e187 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/NewLocalUserCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/NewLocalUserCommand.cs @@ -289,7 +289,7 @@ namespace Microsoft.PowerShell.Commands return ShouldProcess(target, Strings.ActionNewUser); } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalGroupCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalGroupCommand.cs index 71f0e30ab4..2fc7c33211 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalGroupCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalGroupCommand.cs @@ -207,7 +207,7 @@ namespace Microsoft.PowerShell.Commands return ShouldProcess(target, Strings.ActionRemoveGroup); } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalGroupMemberCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalGroupMemberCommand.cs index a6cab2dc11..0ed137b08f 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalGroupMemberCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalGroupMemberCommand.cs @@ -296,7 +296,7 @@ namespace Microsoft.PowerShell.Commands } } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalUserCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalUserCommand.cs index d7cf666161..4ef9da3b59 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalUserCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RemoveLocalUserCommand.cs @@ -208,7 +208,7 @@ namespace Microsoft.PowerShell.Commands return ShouldProcess(target, Strings.ActionRemoveUser); } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RenameLocalGroupCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RenameLocalGroupCommand.cs index d1984cd2f0..05fd348e95 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RenameLocalGroupCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RenameLocalGroupCommand.cs @@ -227,7 +227,7 @@ namespace Microsoft.PowerShell.Commands return ShouldProcess(groupName, msg); } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RenameLocalUserCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RenameLocalUserCommand.cs index e935a9351a..42250fc6ef 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RenameLocalUserCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/RenameLocalUserCommand.cs @@ -227,7 +227,7 @@ namespace Microsoft.PowerShell.Commands return ShouldProcess(userName, msg); } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/SetLocalGroupCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/SetLocalGroupCommand.cs index 9ccd3273e5..8926848d7e 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/SetLocalGroupCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/SetLocalGroupCommand.cs @@ -174,7 +174,7 @@ namespace Microsoft.PowerShell.Commands return ShouldProcess(target, Strings.ActionSetGroup); } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/SetLocalUserCommand.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/SetLocalUserCommand.cs index 599bd53d97..63756347b6 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/SetLocalUserCommand.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Commands/SetLocalUserCommand.cs @@ -317,7 +317,7 @@ namespace Microsoft.PowerShell.Commands return ShouldProcess(target, Strings.ActionSetUser); } #endregion Private Methods - }//End Class + } -}//End namespace +} diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Sam.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Sam.cs index 4a393d3f4c..ab9d2e8a72 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Sam.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/Sam.cs @@ -1619,12 +1619,12 @@ namespace System.Management.Automation.SecurityAccountsManager FullName = allInfo.FullName.ToString(), Description = allInfo.AdminComment.ToString(), - //TODO: why is this coming up as 864000000000 (number of ticks per day)? + // TODO: why is this coming up as 864000000000 (number of ticks per day)? PasswordChangeableDate = DateTimeFromSam(allInfo.PasswordCanChange.QuadPart), PasswordExpires = DateTimeFromSam(allInfo.PasswordMustChange.QuadPart), - //TODO: why is this coming up as 0X7FFFFFFFFFFFFFFF (largest signed 64-bit, and well out of range of DateTime)? + // TODO: why is this coming up as 0X7FFFFFFFFFFFFFFF (largest signed 64-bit, and well out of range of DateTime)? AccountExpires = DateTimeFromSam(allInfo.AccountExpires.QuadPart), LastLogon = DateTimeFromSam(allInfo.LastLogon.QuadPart), PasswordLastSet = DateTimeFromSam(allInfo.PasswordLastSet.QuadPart), @@ -2778,7 +2778,7 @@ namespace System.Management.Automation.SecurityAccountsManager { // Bug: 7407413 : // If accountname is in the format domain1\user1, - //then AccountName.ToString() will return domain1\domain1\user1 + // then AccountName.ToString() will return domain1\domain1\user1 // Ideally , accountname should be processed to hold only account name (without domain) // as we are keeping the domain in 'DomainName' variable. @@ -2828,7 +2828,7 @@ namespace System.Management.Automation.SecurityAccountsManager switch (info.Use) { - case SID_NAME_USE.SidTypeAlias: //TODO: is this the right thing to do??? + case SID_NAME_USE.SidTypeAlias: // TODO: is this the right thing to do??? case SID_NAME_USE.SidTypeGroup: case SID_NAME_USE.SidTypeWellKnownGroup: rv.ObjectClass = Strings.ObjectClassGroup; @@ -2948,7 +2948,7 @@ namespace System.Management.Automation.SecurityAccountsManager return new UserNotFoundException(context.ObjectName, context.target); case NtStatus.STATUS_SPECIAL_GROUP: // The group specified is a special group and cannot be operated on in the requested fashion. - //case NtStatus.STATUS_SPECIAL_ALIAS: // referred to in source for SAM api, but not in ntstatus.h!!! + // case NtStatus.STATUS_SPECIAL_ALIAS: // referred to in source for SAM api, but not in ntstatus.h!!! return new InvalidOperationException(StringUtil.Format(Strings.InvalidForGroup, context.ObjectName)); @@ -2984,7 +2984,7 @@ namespace System.Management.Automation.SecurityAccountsManager case NtStatus.STATUS_PASSWORD_RESTRICTION: return new InvalidPasswordException(Native.Win32.RtlNtStatusToDosError(ntStatus)); - //TODO: do we want to handle these? + // TODO: do we want to handle these? // they appear to be returned only in functions we are not calling case NtStatus.STATUS_INVALID_SID: // member sid is corrupted case NtStatus.STATUS_INVALID_MEMBER: // member has wrong account type diff --git a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/SamApi.cs b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/SamApi.cs index a459894730..9768eb32d9 100644 --- a/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/SamApi.cs +++ b/src/Microsoft.PowerShell.LocalAccounts/LocalAccounts/SamApi.cs @@ -196,7 +196,7 @@ namespace System.Management.Automation.SecurityAccountsManager.Native.NtSam [StructLayout(LayoutKind.Sequential)] internal struct USER_EXPIRES_INFORMATION { - //LARGE_INTEGER AccountExpires; + // LARGE_INTEGER AccountExpires; public Int64 AccountExpires; } diff --git a/src/Microsoft.PowerShell.ScheduledJob/ScheduledJob.cs b/src/Microsoft.PowerShell.ScheduledJob/ScheduledJob.cs index 46bad5d38f..4f4f9bf891 100644 --- a/src/Microsoft.PowerShell.ScheduledJob/ScheduledJob.cs +++ b/src/Microsoft.PowerShell.ScheduledJob/ScheduledJob.cs @@ -222,7 +222,7 @@ namespace Microsoft.PowerShell.ScheduledJob /// public override void StartJobAsync() { - //StartJob(); + // StartJob(); throw new PSNotSupportedException(); } diff --git a/src/Microsoft.PowerShell.Security/security/AclCommands.cs b/src/Microsoft.PowerShell.Security/security/AclCommands.cs index 79ebb5886b..bc8e063269 100644 --- a/src/Microsoft.PowerShell.Security/security/AclCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/AclCommands.cs @@ -119,7 +119,7 @@ namespace Microsoft.PowerShell.Commands { if (audit) { - //Audit + // Audit result.Properties.Add ( new PSCodeProperty @@ -129,7 +129,7 @@ namespace Microsoft.PowerShell.Commands ) ); } - //CentralAccessPolicyId retrieval does not require elevation, so we always add this property. + // CentralAccessPolicyId retrieval does not require elevation, so we always add this property. result.Properties.Add ( new PSCodeProperty @@ -138,11 +138,11 @@ namespace Microsoft.PowerShell.Commands typeof(SecurityDescriptorCommandsBase).GetMethod("GetCentralAccessPolicyId") ) ); -#if !CORECLR //GetAllCentralAccessPolicies and GetCentralAccessPolicyName are not supported in OneCore powershell - //because function 'LsaQueryCAPs' is not available in OneCoreUAP and NanoServer. +#if !CORECLR // GetAllCentralAccessPolicies and GetCentralAccessPolicyName are not supported in OneCore powershell + // because function 'LsaQueryCAPs' is not available in OneCoreUAP and NanoServer. if (allCentralAccessPolicies) { - //AllCentralAccessPolicies + // AllCentralAccessPolicies result.Properties.Add ( new PSCodeProperty @@ -152,7 +152,7 @@ namespace Microsoft.PowerShell.Commands ) ); } - //CentralAccessPolicyName retrieval does not require elevation, so we always add this property. + // CentralAccessPolicyName retrieval does not require elevation, so we always add this property. result.Properties.Add ( new PSCodeProperty @@ -186,7 +186,7 @@ namespace Microsoft.PowerShell.Commands // them for null causes a presharp warning #pragma warning disable 56506 - //Get path + // Get path return instance.Properties["PSPath"].Value.ToString(); #pragma warning enable 56506 } @@ -214,7 +214,7 @@ namespace Microsoft.PowerShell.Commands throw PSTraceSource.NewArgumentNullException("instance"); } - //Get owner + // Get owner try { IdentityReference ir = sd.GetOwner(typeof(NTAccount)); @@ -254,7 +254,7 @@ namespace Microsoft.PowerShell.Commands throw PSTraceSource.NewArgumentNullException("instance"); } - //Get Group + // Get Group try { IdentityReference ir = sd.GetGroup(typeof(NTAccount)); @@ -293,7 +293,7 @@ namespace Microsoft.PowerShell.Commands PSTraceSource.NewArgumentException("instance"); } - //Get DACL + // Get DACL AuthorizationRuleCollection dacl; CommonObjectSecurity cos = sd as CommonObjectSecurity; if (cos != null) @@ -630,7 +630,7 @@ namespace Microsoft.PowerShell.Commands /// public GetAclCommand() { - //Default for path is the current location + // Default for path is the current location _path = new string[] { "." }; } #region parameters @@ -1592,7 +1592,7 @@ namespace Microsoft.PowerShell.Commands } #endif // !UNIX -}// namespace Microsoft.PowerShell.Commands +} #pragma warning restore 56506 diff --git a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs index 2e2e8c25fe..fd46df5b4f 100644 --- a/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs +++ b/src/Microsoft.PowerShell.Security/security/CertificateProvider.cs @@ -232,7 +232,7 @@ namespace Microsoft.PowerShell.Commands /// internal sealed class X509NativeStore { - //#region tracer + // #region tracer /// /// Initializes a new instance of the X509NativeStore class. @@ -277,7 +277,7 @@ namespace Microsoft.PowerShell.Commands break; default: - //ThrowItemNotFound(storeLocation.ToString(), CertificateProviderItem.StoreLocation); + // ThrowItemNotFound(storeLocation.ToString(), CertificateProviderItem.StoreLocation); break; } @@ -295,7 +295,7 @@ namespace Microsoft.PowerShell.Commands _storeHandle = new CertificateStoreHandle(); _storeHandle.Handle = hCertStore; - //we only do CertControlStore for stores other than UserDS + // we only do CertControlStore for stores other than UserDS if (!string.Equals( _storeName, "UserDS", @@ -679,9 +679,9 @@ namespace Microsoft.PowerShell.Commands if (isContainer) { - if (pathElements.Length == 2) //is a store + if (pathElements.Length == 2) // is a store { - //not support user context + // not support user context if (fUserContext) { string message = CertificateProviderStrings.CannotDeleteUserStore; @@ -692,16 +692,16 @@ namespace Microsoft.PowerShell.Commands RemoveCertStore(pathElements[1], fDeleteKey, path); return; } - else //other container than a store + else // other container than a store { string message = CertificateProviderStrings.CannotRemoveContainer; string errorId = "CannotRemoveContainer"; ThrowInvalidOperation(errorId, message); } } - else //certificate + else // certificate { - //do remove + // do remove X509Certificate2 certificate = outObj as X509Certificate2; RemoveCertItem(certificate, fDeleteKey, !fUserContext, path); return; @@ -750,11 +750,11 @@ namespace Microsoft.PowerShell.Commands string path, string destination) { - //normalize path + // normalize path path = NormalizePath(path); destination = NormalizePath(destination); - //get elements from the path + // get elements from the path string[] pathElements = GetPathElements(path); string[] destElements = GetPathElements(destination); @@ -771,14 +771,14 @@ namespace Microsoft.PowerShell.Commands ThrowInvalidOperation(errorId, message); } - if (destElements.Length != 2) //not a store + if (destElements.Length != 2) // not a store { - //if the destination leads to the same thumbprint + // if the destination leads to the same thumbprint if (destElements.Length == 3 && (string.Equals(pathElements[2], destElements[2], StringComparison.OrdinalIgnoreCase))) { - //in this case we think of destination path as valid - //and strip the thumbprint part + // in this case we think of destination path as valid + // and strip the thumbprint part destination = Path.GetDirectoryName(destination); } else @@ -789,9 +789,9 @@ namespace Microsoft.PowerShell.Commands } } - //the second element is store location - //we do not allow cross context move - //we do not allow the destination store is the same as source + // the second element is store location + // we do not allow cross context move + // we do not allow the destination store is the same as source if (!string.Equals(pathElements[0], destElements[0], StringComparison.OrdinalIgnoreCase)) { @@ -822,9 +822,9 @@ namespace Microsoft.PowerShell.Commands } } - if (cert != null) //we get cert + if (cert != null) // we get cert { - //get destination store + // get destination store bool isDestContainer = false; object store = GetItemAtPath(destination, false, out isDestContainer); @@ -894,10 +894,10 @@ namespace Microsoft.PowerShell.Commands path = NormalizePath(path); - //get the elements from the path + // get the elements from the path string[] pathElements = GetPathElements(path); - //only support creating store + // only support creating store if (pathElements.Length != 2) { string message = CertificateProviderStrings.CannotCreateItem; @@ -907,7 +907,7 @@ namespace Microsoft.PowerShell.Commands bool fUserContext = string.Equals(pathElements[0], "CurrentUser", StringComparison.OrdinalIgnoreCase); - //not support user context + // not support user context if (fUserContext) { string message = CertificateProviderStrings.CannotCreateUserStore; @@ -920,7 +920,7 @@ namespace Microsoft.PowerShell.Commands Security.NativeMethods.CertOpenStoreFlags.CERT_STORE_MAXIMUM_ALLOWED_FLAG | Security.NativeMethods.CertOpenStoreFlags.CERT_SYSTEM_STORE_LOCAL_MACHINE; - //Create new store + // Create new store IntPtr hCertStore = Security.NativeMethods.CertOpenStore( Security.NativeMethods.CertOpenStoreProvider.CERT_STORE_PROV_SYSTEM, Security.NativeMethods.CertOpenStoreEncodingType.X509_ASN_ENCODING, @@ -931,7 +931,7 @@ namespace Microsoft.PowerShell.Commands { throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error()); } - else //free native store handle + else // free native store handle { bool fResult = false; fResult = Security.NativeMethods.CertCloseStore(hCertStore, 0); @@ -1174,7 +1174,7 @@ namespace Microsoft.PowerShell.Commands if (item != null) { - if (!isContainer) //certificate + if (!isContainer) // certificate { // If the filter is null, output the certificate we got. if (filter == null) @@ -1198,7 +1198,7 @@ namespace Microsoft.PowerShell.Commands } } } - else //container + else // container { // The item is a container. If the filter is non null, we don't output it. if (filter != null) @@ -1207,16 +1207,16 @@ namespace Microsoft.PowerShell.Commands } X509StoreLocation storeLocation = item as X509StoreLocation; - if (storeLocation != null) //store location + if (storeLocation != null) // store location { WriteItemObject(item, path, isContainer); } - else //store + else // store { X509NativeStore store = item as X509NativeStore; if (store != null) { - //create X509Store + // create X509Store X509Store outStore = new X509Store( store.StoreName, store.Location.Location); @@ -1257,7 +1257,7 @@ namespace Microsoft.PowerShell.Commands /// protected override string GetChildName(string path) { - //Path for root is empty string + // Path for root is empty string if (path != null && path.Length == 0) { return path; @@ -1571,7 +1571,7 @@ namespace Microsoft.PowerShell.Commands IntPtr hWnd = DetectUIHelper.GetOwnerWindow(Host); - if (keyProvInfo.dwProvType != 0) //legacy + if (keyProvInfo.dwProvType != 0) // legacy { if (hWnd != IntPtr.Zero) { @@ -1606,7 +1606,7 @@ namespace Microsoft.PowerShell.Commands ThrowErrorRemoting(Marshal.GetLastWin32Error()); } } - else //cng key + else // cng key { uint cngKeyFlag = 0; int result = 0; @@ -1692,7 +1692,7 @@ namespace Microsoft.PowerShell.Commands private void RemoveCertStore(string storeName, bool fDeleteKey, string sourcePath) { - //if recurse is true, remove every cert in the store + // if recurse is true, remove every cert in the store IntPtr localName = Security.NativeMethods.CryptFindLocalizedName(storeName); string[] pathElements = GetPathElements(sourcePath); if (IntPtr.Zero == localName)//not find, we can remove @@ -1717,7 +1717,7 @@ namespace Microsoft.PowerShell.Commands certContext = store.GetNextCert(certContext); } - //remove the cert store + // remove the cert store Security.NativeMethods.CertOpenStoreFlags StoreFlags = Security.NativeMethods.CertOpenStoreFlags.CERT_STORE_READONLY_FLAG | Security.NativeMethods.CertOpenStoreFlags.CERT_STORE_OPEN_EXISTING_FLAG | @@ -1725,7 +1725,7 @@ namespace Microsoft.PowerShell.Commands Security.NativeMethods.CertOpenStoreFlags.CERT_STORE_DELETE_FLAG | Security.NativeMethods.CertOpenStoreFlags.CERT_SYSTEM_STORE_LOCAL_MACHINE; - //delete store + // delete store IntPtr hCertStore = Security.NativeMethods.CertOpenStore( Security.NativeMethods.CertOpenStoreProvider.CERT_STORE_PROV_SYSTEM, Security.NativeMethods.CertOpenStoreEncodingType.X509_ASN_ENCODING, @@ -1791,7 +1791,7 @@ namespace Microsoft.PowerShell.Commands [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults")] private void DoRemove(X509Certificate2 cert, bool fDeleteKey, bool fMachine, string sourcePath) { - //get CERT_KEY_PROV_INFO_PROP_ID + // get CERT_KEY_PROV_INFO_PROP_ID int provSize = 0; IntPtr pProvInfo = IntPtr.Zero; bool fHasPrivateKey = false; @@ -1800,7 +1800,7 @@ namespace Microsoft.PowerShell.Commands { if (fDeleteKey) { - //it is fine if below call fails + // it is fine if below call fails if (Security.NativeMethods.CertGetCertificateContextProperty( cert.Handle, Security.NativeMethods.CertPropertyId.CERT_KEY_PROV_INFO_PROP_ID, @@ -1821,15 +1821,15 @@ namespace Microsoft.PowerShell.Commands if (!fHasPrivateKey) { - //raise a verbose message - //we should not use WriteWarning here + // raise a verbose message + // we should not use WriteWarning here string verboseNoPrivatekey = CertificateProviderStrings.VerboseNoPrivateKey; WriteVerbose(verboseNoPrivatekey); } } - //do remove certificate - //should not use the original handle + // do remove certificate + // should not use the original handle if (!Security.NativeMethods.CertDeleteCertificateFromStore( Security.NativeMethods.CertDuplicateCertificateContext(cert.Handle))) @@ -1837,7 +1837,7 @@ namespace Microsoft.PowerShell.Commands throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error()); } - //commit the change to physical store + // commit the change to physical store if (sourcePath.Contains("UserDS")) { Security.NativeMethods.CERT_CONTEXT context = @@ -1846,9 +1846,9 @@ namespace Microsoft.PowerShell.Commands CommitUserDS(context.hCertStore); } - //TODO: Log Cert Delete + // TODO: Log Cert Delete - //delete private key + // delete private key if (fDeleteKey && fHasPrivateKey) { DoDeleteKey(pProvInfo); @@ -1889,10 +1889,10 @@ namespace Microsoft.PowerShell.Commands [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults")] private void DoMove(string destination, X509Certificate2 cert, X509NativeStore store, string sourcePath) { - IntPtr dupCert = IntPtr.Zero; //should not free this + IntPtr dupCert = IntPtr.Zero; // should not free this IntPtr outCert = IntPtr.Zero; - //duplicate cert first + // duplicate cert first dupCert = Security.NativeMethods.CertDuplicateCertificateContext(cert.Handle); if (dupCert == IntPtr.Zero) @@ -1915,10 +1915,10 @@ namespace Microsoft.PowerShell.Commands throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error()); } - //TODO: log cert move + // TODO: log cert move } - //commit the change to physical store + // commit the change to physical store if (destination.Contains("UserDS")) { CommitUserDS(store.StoreHandle); @@ -1931,7 +1931,7 @@ namespace Microsoft.PowerShell.Commands CommitUserDS(context.hCertStore); } - //get the output object + // get the output object X509Certificate2 outObj = new X509Certificate2(outCert); string certName = GetCertName(outObj); string certPath = MakePath(destination, certName); @@ -2858,7 +2858,7 @@ namespace Microsoft.PowerShell.Commands get { Hashtable storeNames; - //always try to get new names + // always try to get new names storeNames = new Hashtable(StringComparer.OrdinalIgnoreCase); // since there is no managed support to obtain store names, @@ -2986,20 +2986,20 @@ namespace Microsoft.PowerShell.Commands if (DownLevelHelper.TrustedIssuerSupported()) { int propSize = 0; - //try to get the property - //it is fine if fail for not there + // try to get the property + // it is fine if fail for not there if (Security.NativeMethods.CertGetCertificateContextProperty( cert.Handle, Security.NativeMethods.CertPropertyId.CERT_SEND_AS_TRUSTED_ISSUER_PROP_ID, IntPtr.Zero, ref propSize)) { - //we have the property + // we have the property fHasProperty = true; } else { - //if fail + // if fail int error = Marshal.GetLastWin32Error(); if (error != Security.NativeMethods.CRYPT_E_NOT_FOUND) { @@ -3030,27 +3030,27 @@ namespace Microsoft.PowerShell.Commands { if (certPath != null) { - //try to open the store and get the cert out - //in case the store handle is already released + // try to open the store and get the cert out + // in case the store handle is already released string[] pathElements = GetPathElements(certPath); - //certpath is in the format: Microsoft.Powershell.Security\ - //Certificate::CurrentUser(LocalMachine)\my\HashID - //obtained pathElements[0] is Microsoft.Powershell.Security - //obtained pathElements[1] is Certificate::CurrentUser - //obtained pathElements[2] is MY - //obtained pathElements[3] is HashID + // certpath is in the format: Microsoft.Powershell.Security\ + // Certificate::CurrentUser(LocalMachine)\my\HashID + // obtained pathElements[0] is Microsoft.Powershell.Security + // obtained pathElements[1] is Certificate::CurrentUser + // obtained pathElements[2] is MY + // obtained pathElements[3] is HashID bool fUserContext = string.Equals(pathElements[1], "Certificate::CurrentUser", StringComparison.OrdinalIgnoreCase); X509StoreLocation storeLocation = new X509StoreLocation(fUserContext ? StoreLocation.CurrentUser : StoreLocation.LocalMachine); - //get certificate from the store pathElements[2] + // get certificate from the store pathElements[2] X509NativeStore store = null; store = new X509NativeStore(storeLocation, pathElements[2]); - store.Open(true); //including archival flag + store.Open(true); // including archival flag IntPtr certContext = store.GetCertByName(pathElements[3]); @@ -3061,13 +3061,13 @@ namespace Microsoft.PowerShell.Commands } } - if (addProperty) //should add the property + if (addProperty) // should add the property { propertyPtr = Marshal.AllocHGlobal(Marshal.SizeOf(dataBlob)); Marshal.StructureToPtr(dataBlob, propertyPtr, false); } - //set property + // set property if (!Security.NativeMethods.CertSetCertificateContextProperty( certFromStore != null ? certFromStore.Handle : cert.Handle, Security.NativeMethods.CertPropertyId.CERT_SEND_AS_TRUSTED_ISSUER_PROP_ID, diff --git a/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs b/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs index 0c79c51ab8..73029997bf 100644 --- a/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/ExecutionPolicyCommands.cs @@ -104,8 +104,8 @@ namespace Microsoft.PowerShell.Commands { WriteObject(SecuritySupport.GetExecutionPolicy(shellId)); } - }//End BeginProcess() - }//End Class + } + } /// /// Defines the implementation of the 'Set-ExecutionPolicy' cmdlet. @@ -238,10 +238,10 @@ namespace Microsoft.PowerShell.Commands EtwLoggingStrings.ExecutionPolicyName, executionPolicy, null); #endif } - }//End ProcessRecord() + } // Determine if we should process this policy change -#if CORECLR //Seems that we cannot find if the cmdlet is executed interactive or through a script on CoreCLR +#if CORECLR // Seems that we cannot find if the cmdlet is executed interactive or through a script on CoreCLR private bool ShouldProcessPolicyChange(string localPreference) { return ShouldProcess(localPreference); @@ -340,5 +340,5 @@ namespace Microsoft.PowerShell.Commands errorRecord.ErrorDetails = new ErrorDetails(message); ThrowTerminatingError(errorRecord); } - }//End Class -}//End namespace + } +} diff --git a/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs b/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs index 9156d18d3e..70f33308fb 100644 --- a/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/SignatureCommands.cs @@ -478,7 +478,7 @@ namespace Microsoft.PowerShell.Commands { // remember to reset the read-only attribute later readOnlyFileInfo = fInfo; - //Make sure the file is not read only + // Make sure the file is not read only fInfo.Attributes &= ~(FileAttributes.ReadOnly); } } diff --git a/src/Microsoft.WSMan.Management/ConfigProvider.cs b/src/Microsoft.WSMan.Management/ConfigProvider.cs index 666df61547..e5de94af2d 100644 --- a/src/Microsoft.WSMan.Management/ConfigProvider.cs +++ b/src/Microsoft.WSMan.Management/ConfigProvider.cs @@ -27,7 +27,7 @@ namespace Microsoft.WSMan.Management [CmdletProvider(WSManStringLiterals.ProviderName, ProviderCapabilities.Credentials)] public sealed partial class WSManConfigProvider : NavigationCmdletProvider, ICmdletProviderSupportsHelp { - //Plugin Name Storage + // Plugin Name Storage private PSObject objPluginNames = null; private ServiceController winrmServiceController; @@ -62,17 +62,17 @@ namespace Microsoft.WSMan.Management /// string ICmdletProviderSupportsHelp.GetHelpMaml(string helpItemName, string path) { - //Get the leaf node from the path for which help is requested. + // Get the leaf node from the path for which help is requested. int ChildIndex = path.LastIndexOf("\\", StringComparison.OrdinalIgnoreCase); if (ChildIndex == -1) { - //Means we are at host level, where no new-item is supported. Return empty string. + // Means we are at host level, where no new-item is supported. Return empty string. return string.Empty; } String child = path.Substring(ChildIndex + 1); - //We only return help for the below set of 5 commands, not for any other case. + // We only return help for the below set of 5 commands, not for any other case. switch (helpItemName) { case "New-Item": @@ -109,7 +109,7 @@ namespace Microsoft.WSMan.Management if (helpFile == null) { - //Can't find help file. Return empty string + // Can't find help file. Return empty string return string.Empty; } @@ -158,7 +158,7 @@ namespace Microsoft.WSMan.Management string verb = helpItemName.Split('-')[0]; string noun = helpItemName.Substring(helpItemName.IndexOf('-') + 1); - //Compose XPath query to select the appropriate node based on the verb, noun and id + // Compose XPath query to select the appropriate node based on the verb, noun and id string xpathQuery = "/msh:helpItems/msh:providerHelp/msh:CmdletHelpPaths/msh:CmdletHelpPath[@id='" + child + "' or @ID='" + child + "']/command:command/command:details[command:verb='" + verb + "' and command:noun='" + noun + "']"; // Execute the XPath query and if the command was found, return its MAML snippet @@ -273,7 +273,7 @@ namespace Microsoft.WSMan.Management child = child.Remove(child.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); } - //For Listeners only ... should remove Listener from listener\listener but not from listener_[Hashcode] + // For Listeners only ... should remove Listener from listener\listener but not from listener_[Hashcode] if (parent.Equals(WSManStringLiterals.containerListener, StringComparison.OrdinalIgnoreCase) && child.StartsWith(parent, StringComparison.OrdinalIgnoreCase)) { if (!child.StartsWith(parent + "_", StringComparison.OrdinalIgnoreCase)) @@ -360,7 +360,7 @@ namespace Microsoft.WSMan.Management return true; } - //if endswith '\', removes it. + // if endswith '\', removes it. if (path.EndsWith(WSManStringLiterals.DefaultPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase)) { path = path.Remove(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); @@ -368,7 +368,7 @@ namespace Microsoft.WSMan.Management if (path.Contains(WSManStringLiterals.DefaultPathSeparator.ToString())) { - //Get the ChildName + // Get the ChildName childname = path.Substring(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator) + 1); } @@ -378,10 +378,10 @@ namespace Microsoft.WSMan.Management return true; } - //Get the wsman host name to find the session object + // Get the wsman host name to find the session object string host = GetHostName(path); - //Chks the WinRM Service + // Chks the WinRM Service if (IsPathLocalMachine(host)) { if (!IsWSManServiceRunning()) @@ -395,7 +395,7 @@ namespace Microsoft.WSMan.Management lock(WSManHelper.AutoSession) { - //Gets the session object from the cache. + // Gets the session object from the cache. object sessionobj; SessionObjCache.TryGetValue(host, out sessionobj); @@ -445,7 +445,7 @@ namespace Microsoft.WSMan.Management { strPathCheck = strPathCheck + WSManStringLiterals.containerPlugin; - //Check for Plugin path + // Check for Plugin path XmlDocument xmlPlugins = FindResourceValue(sessionobj, WsManURI, null); string currentpluginname = string.Empty; int PluginCount = GetPluginNames(xmlPlugins, out objPluginNames, out currentpluginname, path); @@ -593,7 +593,7 @@ namespace Microsoft.WSMan.Management if (path.Contains(WSManStringLiterals.DefaultPathSeparator.ToString())) { - //Get the ChildName + // Get the ChildName childname = path.Substring(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator) + 1); } else @@ -614,20 +614,20 @@ namespace Microsoft.WSMan.Management path = path.Substring(0, path.LastIndexOf(childname, StringComparison.OrdinalIgnoreCase)); - //Get the wsman host name to find the session object + // Get the wsman host name to find the session object string host = GetHostName(path); string uri = NormalizePath(path, host); lock(WSManHelper.AutoSession) { - //Gets the session object from the cache. + // Gets the session object from the cache. object sessionobj; SessionObjCache.TryGetValue(host, out sessionobj); XmlDocument xmlResource = FindResourceValue(sessionobj, uri, null); if (xmlResource == null) { return; } - //if endswith '\', removes it. + // if endswith '\', removes it. if (path.EndsWith(WSManStringLiterals.DefaultPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase)) { path = path.Remove(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); @@ -897,7 +897,7 @@ namespace Microsoft.WSMan.Management if (path.Contains(WSManStringLiterals.DefaultPathSeparator.ToString())) { - //Get the ChildName + // Get the ChildName ChildName = path.Substring(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator) + 1); } else @@ -942,11 +942,11 @@ namespace Microsoft.WSMan.Management path = path.Substring(0, path.LastIndexOf(ChildName, StringComparison.OrdinalIgnoreCase)); - //Get the wsman host name to find the session object + // Get the wsman host name to find the session object string host = GetHostName(path); string uri = NormalizePath(path, host); - //Chk for Winrm Service + // Chk for Winrm Service if (IsPathLocalMachine(host)) { if (!IsWSManServiceRunning()) @@ -960,14 +960,14 @@ namespace Microsoft.WSMan.Management lock(WSManHelper.AutoSession) { - //Gets the session object from the cache. + // Gets the session object from the cache. object sessionobj; Dictionary SessionObjCache = WSManHelper.GetSessionObjCache(); SessionObjCache.TryGetValue(host, out sessionobj); List warningMessage = new List(); - //if endswith '\', removes it. + // if endswith '\', removes it. if (path.EndsWith(WSManStringLiterals.DefaultPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase)) { path = path.Remove(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); @@ -1162,7 +1162,7 @@ namespace Microsoft.WSMan.Management } } - //NameSpace:Resources/NameSpace:Resource[@ResourceUri={''}]/NameSpace:Security[@Uri='{2}'] + // NameSpace:Resources/NameSpace:Resource[@ResourceUri={''}]/NameSpace:Security[@Uri='{2}'] string xpathToUse = string.Format( CultureInfo.InvariantCulture, "{0}:{1}/{0}:{2}[@{6}='{7}']/{0}:{3}[@{4}='{5}']", @@ -1381,12 +1381,12 @@ namespace Microsoft.WSMan.Management string hostname = GetHostName(path); if (path.EndsWith(hostname + WSManStringLiterals.DefaultPathSeparator + WSManStringLiterals.containerClient, StringComparison.OrdinalIgnoreCase)) { - //To have Tab completion. + // To have Tab completion. return new WSManProviderSetItemDynamicParameters(); } else if (path.EndsWith(hostname + WSManStringLiterals.DefaultPathSeparator + WSManStringLiterals.containerClient + WSManStringLiterals.DefaultPathSeparator + WSManStringLiterals.containerTrustedHosts, StringComparison.OrdinalIgnoreCase)) { - //To Support Concatenate parameter for trustedhosts. + // To Support Concatenate parameter for trustedhosts. return new WSManProviderSetItemDynamicParameters(); } } @@ -1439,7 +1439,7 @@ namespace Microsoft.WSMan.Management return true; } - //if endswith '\', removes it. + // if endswith '\', removes it. if (path.EndsWith(WSManStringLiterals.DefaultPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase)) { path = path.Remove(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); @@ -1447,7 +1447,7 @@ namespace Microsoft.WSMan.Management if (path.Contains(WSManStringLiterals.DefaultPathSeparator.ToString())) { - //Get the ChildName + // Get the ChildName childname = path.Substring(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator) + 1); } @@ -1457,13 +1457,13 @@ namespace Microsoft.WSMan.Management return true; } - //Get the wsman host name to find the session object + // Get the wsman host name to find the session object string host = GetHostName(path); string WsManURI = NormalizePath(path, host); lock(WSManHelper.AutoSession) { - //Gets the session object from the cache. + // Gets the session object from the cache. object sessionobj; SessionObjCache.TryGetValue(host, out sessionobj); @@ -1524,7 +1524,7 @@ namespace Microsoft.WSMan.Management { strPathCheck = strPathCheck + WSManStringLiterals.containerPlugin; - //Check for Plugin path + // Check for Plugin path if (path.EndsWith(strPathCheck, StringComparison.OrdinalIgnoreCase)) { return true; @@ -1643,7 +1643,7 @@ namespace Microsoft.WSMan.Management if (path.Contains(WSManStringLiterals.DefaultPathSeparator.ToString())) { - //Get the ChildName + // Get the ChildName ChildName = path.Substring(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator) + 1); } else @@ -1664,11 +1664,11 @@ namespace Microsoft.WSMan.Management path = path.Substring(0, path.LastIndexOf(ChildName, StringComparison.OrdinalIgnoreCase)); - //Get the wsman host name to find the session object + // Get the wsman host name to find the session object string host = GetHostName(path); string uri = NormalizePath(path, host); - //Chk for Winrm Service + // Chk for Winrm Service if (IsPathLocalMachine(host)) { if (!IsWSManServiceRunning()) @@ -1680,12 +1680,12 @@ namespace Microsoft.WSMan.Management lock(WSManHelper.AutoSession) { - //Gets the session object from the cache. + // Gets the session object from the cache. object sessionobj; Dictionary SessionObjCache = WSManHelper.GetSessionObjCache(); SessionObjCache.TryGetValue(host, out sessionobj); - //if endswith '\', removes it. + // if endswith '\', removes it. if (path.EndsWith(WSManStringLiterals.DefaultPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase)) { path = path.Remove(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); @@ -1699,7 +1699,7 @@ namespace Microsoft.WSMan.Management { if (path.EndsWith(strPathCheck + WSManStringLiterals.containerPlugin, StringComparison.OrdinalIgnoreCase)) { - //Deletes all the Plugin when user is in WsMan:\Localhost\Plugin. + // Deletes all the Plugin when user is in WsMan:\Localhost\Plugin. string pluginUri = uri + "?Name=" + ChildName; DeleteResourceValue(sessionobj, pluginUri, null, recurse); return; @@ -1815,7 +1815,7 @@ namespace Microsoft.WSMan.Management string inputStr = string.Empty; object sessionobj; - //if endswith '\', removes it. + // if endswith '\', removes it. if (path.EndsWith(WSManStringLiterals.DefaultPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase)) { path = path.Remove(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); @@ -1828,7 +1828,7 @@ namespace Microsoft.WSMan.Management return; } - //Get the wsman host name to find the session object + // Get the wsman host name to find the session object string host = GetHostName(path); if (string.IsNullOrEmpty(host)) @@ -1836,7 +1836,7 @@ namespace Microsoft.WSMan.Management throw new ArgumentException(helper.GetResourceMsgFromResourcetext("InvalidPath")); } - //Chk for Winrm Service + // Chk for Winrm Service if (IsPathLocalMachine(host)) { if (!IsWSManServiceRunning()) @@ -2473,7 +2473,7 @@ namespace Microsoft.WSMan.Management string filePath = this.SessionState.Path.GetUnresolvedProviderPathFromPSPath(path); putstr = File.ReadAllText(filePath, System.Text.Encoding.UTF8); } - //known exceptions + // known exceptions catch (ArgumentNullException e) { ErrorRecord er = new ErrorRecord(e, "ArgumentNullException", ErrorCategory.InvalidOperation, null); @@ -2519,7 +2519,7 @@ namespace Microsoft.WSMan.Management string sHostname = path; try { - //HostName is always followed by root name + // HostName is always followed by root name if (path.Contains(WSManStringLiterals.DefaultPathSeparator.ToString())) { sHostname = path.Substring(0, path.IndexOf(WSManStringLiterals.DefaultPathSeparator)); @@ -2686,8 +2686,8 @@ namespace Microsoft.WSMan.Management { foreach (string key in value.Keys) { - //to make sure we dont set values at inner level. - //for eg: when set-item at winrm/config we dont take input at below level + // to make sure we dont set values at inner level. + // for eg: when set-item at winrm/config we dont take input at below level if (!IsPKey(key, ResourceURI)) { if (node.ChildNodes[i].LocalName.Equals(key, StringComparison.OrdinalIgnoreCase)) @@ -2823,7 +2823,7 @@ namespace Microsoft.WSMan.Management { try { - //Support only for Listener,plugin and ClientCertificate. + // Support only for Listener,plugin and ClientCertificate. if (ResourceURI.Contains(WSManStringLiterals.containerPlugin) || ResourceURI.Contains(WSManStringLiterals.containerListener) || ResourceURI.Contains(WSManStringLiterals.containerCertMapping)) { if (cmdlinevalues != null) @@ -3233,12 +3233,12 @@ namespace Microsoft.WSMan.Management if (objSessionObject != null) { XmlDocument ConfigXml = GetResourceValue(objSessionObject, uri, null); - //Moving in to + // Moving in to foreach (XmlNode node in ConfigXml.ChildNodes) { foreach (XmlNode node1 in node.ChildNodes) { - //Getting Top Element in + // Getting Top Element in if ( (node1.ChildNodes.Count == 0) || node1.FirstChild.Name.Equals("#text", StringComparison.OrdinalIgnoreCase)) { mshobject.Properties.Add(new PSNoteProperty(node1.LocalName, node1.InnerText)); @@ -3246,7 +3246,7 @@ namespace Microsoft.WSMan.Management } } } - //Getting the Fixed root nodes. + // Getting the Fixed root nodes. foreach (string root in WinRmRootConfigs) { mshobject.Properties.Add(new PSNoteProperty(root, WSManStringLiterals.ContainerChildValue)); @@ -3267,7 +3267,7 @@ namespace Microsoft.WSMan.Management PSObject mshObject = new PSObject(); foreach (XmlNode node in xmlnode.ChildNodes) { - //If node contains 0 child-nodes, it is empty node, if it's name = "#text" then it's a simple node. + // If node contains 0 child-nodes, it is empty node, if it's name = "#text" then it's a simple node. if ( (node.ChildNodes.Count == 0) || node.FirstChild.Name.Equals("#text", StringComparison.OrdinalIgnoreCase)) { XmlAttribute attrSource = null; @@ -3442,20 +3442,20 @@ namespace Microsoft.WSMan.Management throw new ArgumentNullException(path); } - //if endswith '\', removes it. + // if endswith '\', removes it. if (path.EndsWith(WSManStringLiterals.DefaultPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase)) { path = path.Remove(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); } - //Get the wsman host name to find the session object + // Get the wsman host name to find the session object string host = GetHostName(path); if (string.IsNullOrEmpty(host)) { throw new InvalidOperationException("InvalidPath"); } - //Chks the WinRM Service + // Chks the WinRM Service if (IsPathLocalMachine(host) && (!IsWSManServiceRunning())) { AssertError("WinRMServiceError", false); @@ -3464,11 +3464,11 @@ namespace Microsoft.WSMan.Management lock(WSManHelper.AutoSession) { object sessionobj; - //gets the sessionobject + // gets the sessionobject Dictionary SessionObjCache = WSManHelper.GetSessionObjCache(); SessionObjCache.TryGetValue(host, out sessionobj); - //Normalize to the required uri + // Normalize to the required uri string uri = NormalizePath(path, host); string strPathchk = host + WSManStringLiterals.DefaultPathSeparator; @@ -3754,14 +3754,14 @@ namespace Microsoft.WSMan.Management { switch (methodname) { - //Get the items at Config level + // Get the items at Config level case ProviderMethods.GetChildItems: PSObject obj = new PSObject(); obj.Properties.Add(new PSNoteProperty(key, WSManStringLiterals.ContainerChildValue)); WritePSObjectPropertiesAsWSManElementObjects(obj, path, (string[])Keyscache[key], null, WsManElementObjectTypes.WSManConfigContainerElement, recurse); - //WriteItemObject(new WSManConfigContainerElement(key, WSManStringLiterals.ContainerChildValue, (string[])Keyscache[key]), path, true); + // WriteItemObject(new WSManConfigContainerElement(key, WSManStringLiterals.ContainerChildValue, (string[])Keyscache[key]), path, true); break; - //Get the names of container at config level + // Get the names of container at config level case ProviderMethods.GetChildNames: WriteItemObject(key, path, true); break; @@ -3883,7 +3883,7 @@ namespace Microsoft.WSMan.Management { return true; } - //if endswith '\', removes it. + // if endswith '\', removes it. if (path.EndsWith(WSManStringLiterals.DefaultPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase)) path = path.Remove(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); @@ -3900,7 +3900,7 @@ namespace Microsoft.WSMan.Management ChildName = path; } - //Get the wsman host name to find the session object + // Get the wsman host name to find the session object string host = GetHostName(path); if (string.IsNullOrEmpty(host)) @@ -3909,7 +3909,7 @@ namespace Microsoft.WSMan.Management } - //Chks the WinRM Service + // Chks the WinRM Service if (IsPathLocalMachine(host)) { if (!IsWSManServiceRunning()) @@ -3919,7 +3919,7 @@ namespace Microsoft.WSMan.Management } } - //Get URI to pass to WsMan Automation API + // Get URI to pass to WsMan Automation API string uri = NormalizePath(path, host); if (string.IsNullOrEmpty(uri)) @@ -3934,7 +3934,7 @@ namespace Microsoft.WSMan.Management SessionObjCache.TryGetValue(host, out sessionobj); strpathChk = host + WSManStringLiterals.DefaultPathSeparator; - //Check for host path + // Check for host path if (path.Equals(host, StringComparison.OrdinalIgnoreCase)) { return true; @@ -3942,7 +3942,7 @@ namespace Microsoft.WSMan.Management if (path.StartsWith(strpathChk + WSManStringLiterals.containerPlugin, StringComparison.OrdinalIgnoreCase)) { - //Check for Plugin path + // Check for Plugin path if (path.Equals(strpathChk + WSManStringLiterals.containerPlugin, StringComparison.OrdinalIgnoreCase)) { return true; @@ -4124,17 +4124,17 @@ namespace Microsoft.WSMan.Management if (pos == -1) { - //means the path was only till the CurrentNode. Nothing ahead + // means the path was only till the CurrentNode. Nothing ahead return true; } - //Get the object cache from the listener object + // Get the object cache from the listener object PSObject obj = (PSObject)objcache[CurrentNode]; CurrentNode = RemainingPath.Substring(pos+1); if (CurrentNode.IndexOf(WSManStringLiterals.DefaultPathSeparator) != -1) { - //No more directories allowed after listeners objects + // No more directories allowed after listeners objects return false; } @@ -4202,20 +4202,20 @@ namespace Microsoft.WSMan.Management return; } - //if endswith '\', removes it. + // if endswith '\', removes it. if (path.EndsWith(WSManStringLiterals.DefaultPathSeparator.ToString(), StringComparison.OrdinalIgnoreCase)) { path = path.Remove(path.LastIndexOf(WSManStringLiterals.DefaultPathSeparator)); } - //Get the wsman host name to find the session object + // Get the wsman host name to find the session object string host = GetHostName(path); if (string.IsNullOrEmpty(host)) { throw new InvalidOperationException("InvalidPath"); } - //Checks the WinRM Service + // Checks the WinRM Service if (IsPathLocalMachine(host)) { if (!IsWSManServiceRunning()) @@ -4235,10 +4235,10 @@ namespace Microsoft.WSMan.Management lock(WSManHelper.AutoSession) { object sessionobj; - //gets the sessionobject + // gets the sessionobject SessionObjCache.TryGetValue(host, out sessionobj); - //Normalize to the required uri + // Normalize to the required uri string uri = NormalizePath(path, host); string strPathchk = host + WSManStringLiterals.DefaultPathSeparator; @@ -4248,11 +4248,11 @@ namespace Microsoft.WSMan.Management PSObject obj = BuildHostLevelPSObjectArrayList(sessionobj, uri, false); switch (methodname) { - //Get the items at Config level + // Get the items at Config level case ProviderMethods.GetChildItems: WritePSObjectPropertiesAsWSManElementObjects(obj, path, null, null, WsManElementObjectTypes.WSManConfigLeafElement, recurse); break; - //Get the names of container at config level + // Get the names of container at config level case ProviderMethods.GetChildNames: WritePSObjectPropertyNames(obj, path); break; @@ -4283,18 +4283,18 @@ namespace Microsoft.WSMan.Management { switch (methodname) { - //Get the items at Plugin level + // Get the items at Plugin level case ProviderMethods.GetChildItems: foreach (PSPropertyInfo p in objPluginNames.Properties) { PSObject obj = new PSObject(); obj.Properties.Add(new PSNoteProperty(p.Name, p.Value)); WritePSObjectPropertiesAsWSManElementObjects(obj, path, new string[] { "Name=" + p.Name }, null, WsManElementObjectTypes.WSManConfigContainerElement, recurse); - //WriteItemObject(new PSObject(new WSManConfigContainerElement(p.Name, p.Value.ToString(), new string[] { "Name=" + p.Name })), path + WSManStringLiterals.DefaultPathSeparator + p.Name, true); + // WriteItemObject(new PSObject(new WSManConfigContainerElement(p.Name, p.Value.ToString(), new string[] { "Name=" + p.Name })), path + WSManStringLiterals.DefaultPathSeparator + p.Name, true); } break; - //Get the names of container at Plugin level + // Get the names of container at Plugin level case ProviderMethods.GetChildNames: WritePSObjectPropertyNames(objPluginNames, path); break; @@ -4320,11 +4320,11 @@ namespace Microsoft.WSMan.Management { switch (methodname) { - //Get the items at Plugin level + // Get the items at Plugin level case ProviderMethods.GetChildItems: WritePSObjectPropertiesAsWSManElementObjects(objPluginlevel, path, null, null, WsManElementObjectTypes.WSManConfigLeafElement, recurse); break; - //Get the names of container at Plugin level + // Get the names of container at Plugin level case ProviderMethods.GetChildNames: WritePSObjectPropertyNames(objPluginlevel, path); break; @@ -4380,14 +4380,14 @@ namespace Microsoft.WSMan.Management { switch (methodname) { - //Get the items at Plugin level + // Get the items at Plugin level case ProviderMethods.GetChildItems: string[] key = new string[] { "Uri" + WSManStringLiterals.Equalto + p.Properties["ResourceURI"].Value.ToString() }; PSObject obj = new PSObject(); obj.Properties.Add(new PSNoteProperty(p.Properties["ResourceDir"].Value.ToString(), WSManStringLiterals.ContainerChildValue)); WritePSObjectPropertiesAsWSManElementObjects(obj, path, key, null, WsManElementObjectTypes.WSManConfigContainerElement, recurse); - //WriteItemObject(new WSManConfigContainerElement(p.Properties["ResourceDir"].Value.ToString(), WSManStringLiterals.ContainerChildValue, key), path + WSManStringLiterals.DefaultPathSeparator + p.Properties["ResourceDir"].Value.ToString(), true); + // WriteItemObject(new WSManConfigContainerElement(p.Properties["ResourceDir"].Value.ToString(), WSManStringLiterals.ContainerChildValue, key), path + WSManStringLiterals.DefaultPathSeparator + p.Properties["ResourceDir"].Value.ToString(), true); break; case ProviderMethods.GetChildNames: WriteItemObject(p.Properties["ResourceDir"].Value.ToString(), path, true); @@ -4427,7 +4427,7 @@ namespace Microsoft.WSMan.Management p.Properties.Remove("ResourceDir"); switch (methodname) { - //Get the items at Initparams level + // Get the items at Initparams level case ProviderMethods.GetChildItems: WritePSObjectPropertiesAsWSManElementObjects(p, path, null, null, WsManElementObjectTypes.WSManConfigLeafElement, recurse); break; @@ -4455,13 +4455,13 @@ namespace Microsoft.WSMan.Management objsecurity.Properties.Remove("ResourceDir"); switch (methodname) { - //Get the items at Security level + // Get the items at Security level case ProviderMethods.GetChildItems: string key = "Uri" + WSManStringLiterals.Equalto + objsecurity.Properties["Uri"].Value.ToString(); PSObject obj = new PSObject(); obj.Properties.Add(new PSNoteProperty(objsecurity.Properties["SecurityDIR"].Value.ToString(), WSManStringLiterals.ContainerChildValue)); WritePSObjectPropertiesAsWSManElementObjects(obj, path, new string[] { key }, null, WsManElementObjectTypes.WSManConfigContainerElement, recurse); - //WriteItemObject(new WSManConfigContainerElement(objsecurity.Properties["SecurityDIR"].Value.ToString(), WSManStringLiterals.ContainerChildValue, new string[] { key }), path + WSManStringLiterals.DefaultPathSeparator + objsecurity.Properties["SecurityDIR"].Value.ToString(), true); + // WriteItemObject(new WSManConfigContainerElement(objsecurity.Properties["SecurityDIR"].Value.ToString(), WSManStringLiterals.ContainerChildValue, new string[] { key }), path + WSManStringLiterals.DefaultPathSeparator + objsecurity.Properties["SecurityDIR"].Value.ToString(), true); break; case ProviderMethods.GetChildNames: @@ -4478,7 +4478,7 @@ namespace Microsoft.WSMan.Management objsecurity.Properties.Remove("SecurityDIR"); switch (methodname) { - //Get the items at Security level + // Get the items at Security level case ProviderMethods.GetChildItems: WritePSObjectPropertiesAsWSManElementObjects(objsecurity, path, null, null, WsManElementObjectTypes.WSManConfigLeafElement, recurse); break; @@ -4505,7 +4505,7 @@ namespace Microsoft.WSMan.Management { switch (methodname) { - //Get the items at Initparams level + // Get the items at Initparams level case ProviderMethods.GetChildItems: WritePSObjectPropertiesAsWSManElementObjects(p, path, null, "InitParams", WsManElementObjectTypes.WSManConfigLeafElement, recurse); break; @@ -4649,7 +4649,7 @@ namespace Microsoft.WSMan.Management } catch (CmdletInvocationException) { - //Eating cmdlet invocation exception. The exception is thrown when No is given. + // Eating cmdlet invocation exception. The exception is thrown when No is given. } } @@ -4661,13 +4661,13 @@ namespace Microsoft.WSMan.Management private bool IsPathLocalMachine(string host) { bool hostfound = false; - //Check is Localhost + // Check is Localhost if (host.Equals("localhost", StringComparison.OrdinalIgnoreCase)) { hostfound = true; } - //Check is TestMac + // Check is TestMac if (!hostfound) { if (host.Equals(System.Net.Dns.GetHostName(), StringComparison.OrdinalIgnoreCase)) @@ -4676,7 +4676,7 @@ namespace Microsoft.WSMan.Management } } - //Check is TestMac.redmond.microsoft.corp.com + // Check is TestMac.redmond.microsoft.corp.com if (!hostfound) { System.Net.IPHostEntry hostentry = System.Net.Dns.GetHostEntry("localhost"); @@ -4685,7 +4685,7 @@ namespace Microsoft.WSMan.Management hostfound = true; } - //Check is 127.0.0.1 or ::1 + // Check is 127.0.0.1 or ::1 if (!hostfound) { foreach (System.Net.IPAddress ipaddress in hostentry.AddressList) @@ -4698,7 +4698,7 @@ namespace Microsoft.WSMan.Management } } - //check if any IPAddress. + // check if any IPAddress. if (!hostfound) { foreach (System.Net.IPAddress ipaddress in System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName())) @@ -4771,24 +4771,24 @@ namespace Microsoft.WSMan.Management // if (childnode.LocalName.Equals("URI")) // { - // //sbCerts.Append(childnode.LocalName); - // //sbCerts.Append(WSManStringLiterals.Equalto); - // //sbCerts.Append(childnode.InnerText); - // //keys[0] = childnode.LocalName + WSManStringLiterals.Equalto + childnode.InnerText; + // // sbCerts.Append(childnode.LocalName); + // // sbCerts.Append(WSManStringLiterals.Equalto); + // // sbCerts.Append(childnode.InnerText); + // // keys[0] = childnode.LocalName + WSManStringLiterals.Equalto + childnode.InnerText; // } // else if (childnode.LocalName.Equals("Subject")) // { - // //sbCerts.Append(childnode.LocalName); - // //sbCerts.Append(WSManStringLiterals.Equalto); - // //sbCerts.Append(childnode.InnerText); - // //keys[1] = childnode.LocalName + WSManStringLiterals.Equalto + childnode.InnerText; + // // sbCerts.Append(childnode.LocalName); + // // sbCerts.Append(WSManStringLiterals.Equalto); + // // sbCerts.Append(childnode.InnerText); + // // keys[1] = childnode.LocalName + WSManStringLiterals.Equalto + childnode.InnerText; // } // else if (childnode.LocalName.Equals("Issuer")) // { - // //sbCerts.Append(childnode.LocalName); - // //sbCerts.Append(WSManStringLiterals.Equalto); - // //sbCerts.Append(childnode.InnerText); - // //keys[2] = childnode.LocalName + WSManStringLiterals.Equalto + childnode.InnerText; + // // sbCerts.Append(childnode.LocalName); + // // sbCerts.Append(WSManStringLiterals.Equalto); + // // sbCerts.Append(childnode.InnerText); + // // keys[2] = childnode.LocalName + WSManStringLiterals.Equalto + childnode.InnerText; // } InputAttributes.Add(childnode.LocalName, childnode.InnerText); @@ -4796,10 +4796,10 @@ namespace Microsoft.WSMan.Management } GenerateObjectNameAndKeys(InputAttributes, WSManStringLiterals.containerCertMapping, WSManStringLiterals.containerClientCertificate, out ItemName, out keys); - //lCache.Add(WSManStringLiterals.containerClientCertificate + "_" + Math.Abs(sbCerts.ToString().GetHashCode()), objCerts); + // lCache.Add(WSManStringLiterals.containerClientCertificate + "_" + Math.Abs(sbCerts.ToString().GetHashCode()), objCerts); lCache.Add(ItemName, objCerts); kCache.Add(ItemName, keys); - //kCache.Add(WSManStringLiterals.containerClientCertificate + "_" + Math.Abs(sbCerts.ToString().GetHashCode()), keys); + // kCache.Add(WSManStringLiterals.containerClientCertificate + "_" + Math.Abs(sbCerts.ToString().GetHashCode()), keys); } Certcache = lCache; @@ -4826,22 +4826,22 @@ namespace Microsoft.WSMan.Management string ItemName = string.Empty; foreach (XmlNode childnode in node.ChildNodes) { - //if (childnode.LocalName.Equals("Address")) - //{ + // if (childnode.LocalName.Equals("Address")) + // { // sbListener.Append(childnode.LocalName); // sbListener.Append(WSManStringLiterals.Equalto); // sbListener.Append(childnode.InnerText); // Keys[0] = childnode.LocalName + WSManStringLiterals.Equalto + childnode.InnerText; // objListener.Properties.Add(new PSNoteProperty(childnode.LocalName, childnode.InnerText)); - //} - //else if (childnode.LocalName.Equals("Transport")) - //{ + // } + // else if (childnode.LocalName.Equals("Transport")) + // { // sbListener.Append(childnode.LocalName); // sbListener.Append(WSManStringLiterals.Equalto); // sbListener.Append(childnode.InnerText); // Keys[1] = childnode.LocalName + WSManStringLiterals.Equalto + childnode.InnerText; // objListener.Properties.Add(new PSNoteProperty(childnode.LocalName, childnode.InnerText)); - //} + // } if (childnode.LocalName.Equals("ListeningOn")) { @@ -4857,10 +4857,10 @@ namespace Microsoft.WSMan.Management } GenerateObjectNameAndKeys(InputAttributes, WSManStringLiterals.containerListener, WSManStringLiterals.containerListener, out ItemName, out Keys); - //lCache.Add(WSManStringLiterals.containerListener + "_" + Math.Abs(sbListener.ToString().GetHashCode()), objListener); + // lCache.Add(WSManStringLiterals.containerListener + "_" + Math.Abs(sbListener.ToString().GetHashCode()), objListener); lCache.Add(ItemName, objListener); kCache.Add(ItemName, Keys); - //kCache.Add(WSManStringLiterals.containerListener + "_" + Math.Abs(sbListener.ToString().GetHashCode()), Keys); + // kCache.Add(WSManStringLiterals.containerListener + "_" + Math.Abs(sbListener.ToString().GetHashCode()), Keys); } listenercache = lCache; @@ -4896,7 +4896,7 @@ namespace Microsoft.WSMan.Management } } } - //Containers in Plugin Level Configs + // Containers in Plugin Level Configs if (objConfiglvl != null) { objConfiglvl.Properties.Add(new PSNoteProperty("InitializationParameters", WSManStringLiterals.ContainerChildValue)); @@ -4965,7 +4965,7 @@ namespace Microsoft.WSMan.Management objResource.Properties.Add(new PSNoteProperty("SupportsOptions", false)); } - //Processing capabilities + // Processing capabilities XmlDocument xmlCapabilities = new XmlDocument(); xmlCapabilities.LoadXml("" + xe.InnerXml + ""); @@ -4983,8 +4983,8 @@ namespace Microsoft.WSMan.Management objResource.Properties.Add(new PSNoteProperty("Capability", enumcapability)); objResource.Properties.Add(new PSNoteProperty(WSManStringLiterals.containerSecurity, WSManStringLiterals.ContainerChildValue)); - //Process Security in Resources. We add the resource Unique ID in to each security to - //identify in the Provider methods. + // Process Security in Resources. We add the resource Unique ID in to each security to + // identify in the Provider methods. nSecurity = ProcessPluginSecurityLevel(nSecurity, xmlCapabilities, strUniqueResourceId, resourceUri); Resources.Add(objResource); } @@ -5042,7 +5042,7 @@ namespace Microsoft.WSMan.Management XmlNodeList nodelistSecurity = xmlSecurity.GetElementsByTagName(WSManStringLiterals.containerSecurity); if (nodelistSecurity.Count > 0) { - //SecurityLvl = new ArrayList(); + // SecurityLvl = new ArrayList(); foreach (XmlElement xe in nodelistSecurity) { bool ExactMatchFound = false; @@ -5329,7 +5329,7 @@ namespace Microsoft.WSMan.Management private string ConstructSecurityXml(PSObject objinputparams, ArrayList securities, string strResourceIdentity) { - // + // StringBuilder sbvalues = new StringBuilder(string.Empty); if (objinputparams == null && securities == null) { @@ -5382,8 +5382,8 @@ namespace Microsoft.WSMan.Management private string ConstructInitParamsXml(PSObject objinputparams, ArrayList initparams) { // - // - // + // + // StringBuilder sbvalues = new StringBuilder(string.Empty); if (objinputparams == null && initparams == null) { @@ -5490,7 +5490,7 @@ namespace Microsoft.WSMan.Management }; - //Defining Primarykeys for resource uri's + // Defining Primarykeys for resource uri's private static readonly string[] PKeyListener = new string[] { "Address", "Transport" }; private static readonly string[] PKeyPlugin = new string[] { "Name" }; private static readonly string[] PKeyCertMapping = new string[] { "Issuer", "Subject", "Uri" }; diff --git a/src/Microsoft.WSMan.Management/CredSSP.cs b/src/Microsoft.WSMan.Management/CredSSP.cs index 16ee6610a6..996d644a01 100644 --- a/src/Microsoft.WSMan.Management/CredSSP.cs +++ b/src/Microsoft.WSMan.Management/CredSSP.cs @@ -340,7 +340,7 @@ namespace Microsoft.WSMan.Management /// protected override void BeginProcessing() { - //If not running elevated, then throw an "elevation required" error message. + // If not running elevated, then throw an "elevation required" error message. WSManHelper.ThrowIfNotAdministrator(); if (Role.Equals(Client, StringComparison.OrdinalIgnoreCase)) @@ -352,7 +352,7 @@ namespace Microsoft.WSMan.Management { DisableServerSideSettings(); } - }//End BeginProcessing() + } #region IDisposable Members @@ -363,7 +363,7 @@ namespace Microsoft.WSMan.Management void Dispose() { - //CleanUp(); + // CleanUp(); GC.SuppressFinalize(this); } /// @@ -378,7 +378,7 @@ namespace Microsoft.WSMan.Management } #endregion IDisposable Members - }//End Class + } #endregion DisableWsManCredSSP #region EnableCredSSP @@ -428,7 +428,7 @@ namespace Microsoft.WSMan.Management private bool force = false; - //helper variable + // helper variable private WSManHelper helper; // The application name MUST be "wsman" as wsman got approval from security @@ -442,7 +442,7 @@ namespace Microsoft.WSMan.Management /// protected override void BeginProcessing() { - //If not running elevated, then throw an "elevation required" error message. + // If not running elevated, then throw an "elevation required" error message. WSManHelper.ThrowIfNotAdministrator(); helper = new WSManHelper(this); @@ -478,7 +478,7 @@ namespace Microsoft.WSMan.Management { EnableServerSideSettings(); } - }//End BeginProcessing() + } #endregion @@ -504,7 +504,7 @@ namespace Microsoft.WSMan.Management try { - //get the credssp node to check if wsman is configured on this machine + // get the credssp node to check if wsman is configured on this machine string result = m_SessionObj.Get(helper.CredSSP_RUri, 0); XmlNode node = helper.GetXmlNode(result, helper.CredSSP_SNode, helper.CredSSP_XMLNmsp); @@ -520,7 +520,7 @@ namespace Microsoft.WSMan.Management try { XmlDocument xmldoc = new XmlDocument(); - //push the xml string with credssp enabled + // push the xml string with credssp enabled xmldoc.LoadXml(m_SessionObj.Put(helper.CredSSP_RUri, newxmlcontent, 0)); // set the Registry using GroupPolicyObject @@ -582,7 +582,7 @@ namespace Microsoft.WSMan.Management try { - //get the credssp node to check if wsman is configured on this machine + // get the credssp node to check if wsman is configured on this machine string result = m_SessionObj.Get(helper.Service_CredSSP_Uri, 0); XmlNode node = helper.GetXmlNode(result, helper.CredSSP_SNode, @@ -602,7 +602,7 @@ namespace Microsoft.WSMan.Management string newxmlcontent = string.Format(CultureInfo.InvariantCulture, @"true", helper.Service_CredSSP_XMLNmsp); - //push the xml string with credssp enabled + // push the xml string with credssp enabled xmldoc.LoadXml(m_SessionObj.Put(helper.Service_CredSSP_Uri, newxmlcontent, 0)); WriteObject(xmldoc.FirstChild); } @@ -645,7 +645,7 @@ namespace Microsoft.WSMan.Management } } - //saving gpo settings + // saving gpo settings GPO.Save(true, true, new Guid("35378EAC-683F-11D2-A89A-00C04FBBCFA2"), new Guid("7A9206BD-33AF-47af-B832-D4128730E990")); } @@ -658,14 +658,14 @@ namespace Microsoft.WSMan.Management /// private void UpdateGPORegistrySettings(string applicationname, string[] delegatestring, RegistryKey rootKey, string Registry_Path) { - //RegistryKey rootKey = Registry.LocalMachine; + // RegistryKey rootKey = Registry.LocalMachine; RegistryKey Credential_Delegation_Key; RegistryKey Allow_Fresh_Credential_Key; int i = 0; try { string Registry_Path_Credentials_Delegation = Registry_Path + @"\CredentialsDelegation"; - //open the registry key.If key is not present,create a new one + // open the registry key.If key is not present,create a new one Credential_Delegation_Key = rootKey.OpenSubKey(Registry_Path_Credentials_Delegation, true); if (Credential_Delegation_Key == null) Credential_Delegation_Key = rootKey.CreateSubKey(Registry_Path_Credentials_Delegation, RegistryKeyPermissionCheck.ReadWriteSubTree); @@ -729,7 +729,7 @@ namespace Microsoft.WSMan.Management } #endregion IDisposable Members - }//End Class + } #endregion EnableCredSSP #region Get-CredSSP @@ -822,7 +822,7 @@ namespace Microsoft.WSMan.Management /// protected override void BeginProcessing() { - //If not running elevated, then throw an "elevation required" error message. + // If not running elevated, then throw an "elevation required" error message. WSManHelper.ThrowIfNotAdministrator(); helper = new WSManHelper(this); IWSManSession m_SessionObj = null; diff --git a/src/Microsoft.WSMan.Management/InvokeWSManAction.cs b/src/Microsoft.WSMan.Management/InvokeWSManAction.cs index 107a97e494..a7e966820b 100644 --- a/src/Microsoft.WSMan.Management/InvokeWSManAction.cs +++ b/src/Microsoft.WSMan.Management/InvokeWSManAction.cs @@ -259,7 +259,7 @@ namespace Microsoft.WSMan.Management helper.WSManOp = "invoke"; - //create the connection string + // create the connection string connectionStr = helper.CreateConnectionString(connectionuri, port, computername, applicationname); } @@ -272,10 +272,10 @@ namespace Microsoft.WSMan.Management try { - //create the resourcelocator object + // create the resourcelocator object IWSManResourceLocator m_resource = helper.InitializeResourceLocator(optionset, selectorset, null, null, m_wsmanObject, resourceuri); - //create the session object + // create the session object m_session = helper.CreateSessionObject(m_wsmanObject, Authentication, sessionoption, Credential, connectionStr, CertificateThumbprint, usessl.IsPresent); string rootNode = helper.GetRootNodeName(helper.WSManOp, m_resource.ResourceUri, action); @@ -304,7 +304,7 @@ namespace Microsoft.WSMan.Management } - }//End ProcessRecord() + } #region IDisposable Members @@ -315,7 +315,7 @@ namespace Microsoft.WSMan.Management void Dispose() { - //CleanUp(); + // CleanUp(); GC.SuppressFinalize(this); } /// @@ -341,5 +341,5 @@ namespace Microsoft.WSMan.Management } - }//End Class + } } diff --git a/src/Microsoft.WSMan.Management/NewWSManSession.cs b/src/Microsoft.WSMan.Management/NewWSManSession.cs index 7d58bbd640..c026649750 100644 --- a/src/Microsoft.WSMan.Management/NewWSManSession.cs +++ b/src/Microsoft.WSMan.Management/NewWSManSession.cs @@ -252,7 +252,7 @@ namespace Microsoft.WSMan.Management return; } - //Creating the Session Object + // Creating the Session Object SessionOption objSessionOption = new SessionOption(); objSessionOption.SPNPort = spnport; @@ -261,7 +261,7 @@ namespace Microsoft.WSMan.Management objSessionOption.SkipCACheck = skipcacheck; objSessionOption.OperationTimeout = operationtimeout; objSessionOption.SkipRevocationCheck = skiprevocationcheck; - //Proxy Settings + // Proxy Settings objSessionOption.ProxyAccessType = _proxyaccesstype; objSessionOption.ProxyAuthentication = proxyauthentication; @@ -278,6 +278,6 @@ namespace Microsoft.WSMan.Management WriteObject(objSessionOption); - }//End BeginProcessing() - }//End Class + } + } } diff --git a/src/Microsoft.WSMan.Management/PingWSMan.cs b/src/Microsoft.WSMan.Management/PingWSMan.cs index e39ccdb05b..86605b8b76 100644 --- a/src/Microsoft.WSMan.Management/PingWSMan.cs +++ b/src/Microsoft.WSMan.Management/PingWSMan.cs @@ -147,7 +147,7 @@ namespace Microsoft.WSMan.Management try { m_SessionObj = helper.CreateSessionObject(wsmanObject, Authentication, null, Credential, connectionStr, CertificateThumbprint, usessl.IsPresent); - m_SessionObj.Timeout = 1000; //1 sec. we are putting this low so that Test-WSMan can return promptly if the server goes unresponsive. + m_SessionObj.Timeout = 1000; // 1 sec. we are putting this low so that Test-WSMan can return promptly if the server goes unresponsive. XmlDocument xmldoc = new XmlDocument(); xmldoc.LoadXml(m_SessionObj.Identify(0)); WriteObject(xmldoc.DocumentElement); @@ -173,7 +173,7 @@ namespace Microsoft.WSMan.Management if (m_SessionObj != null) Dispose(m_SessionObj); } - }//End BeginProcessing() + } #region IDisposable Members @@ -184,7 +184,7 @@ namespace Microsoft.WSMan.Management void Dispose() { - //CleanUp(); + // CleanUp(); GC.SuppressFinalize(this); } /// @@ -200,6 +200,6 @@ namespace Microsoft.WSMan.Management #endregion IDisposable Members - }//End Class + } #endregion } diff --git a/src/Microsoft.WSMan.Management/Set-QuickConfig.cs b/src/Microsoft.WSMan.Management/Set-QuickConfig.cs index dca89cb55c..aafba40fe8 100644 --- a/src/Microsoft.WSMan.Management/Set-QuickConfig.cs +++ b/src/Microsoft.WSMan.Management/Set-QuickConfig.cs @@ -48,7 +48,7 @@ namespace Microsoft.WSMan.Management private SwitchParameter usessl; - //helper variable + // helper variable private WSManHelper helper; /// @@ -83,7 +83,7 @@ namespace Microsoft.WSMan.Management /// protected override void BeginProcessing() { - //If not running elevated, then throw an "elevation required" error message. + // If not running elevated, then throw an "elevation required" error message. WSManHelper.ThrowIfNotAdministrator(); helper = new WSManHelper(this); String query = helper.GetResourceMsgFromResourcetext("QuickConfigContinueQuery"); @@ -95,7 +95,7 @@ namespace Microsoft.WSMan.Management QuickConfigRemoting(true); QuickConfigRemoting(false); - }//End BeginProcessing() + } #region private @@ -274,7 +274,7 @@ namespace Microsoft.WSMan.Management void Dispose() { - //CleanUp(); + // CleanUp(); GC.SuppressFinalize(this); } /// @@ -290,6 +290,6 @@ namespace Microsoft.WSMan.Management #endregion IDisposable Members - }//End Class + } #endregion Set-WsManQuickConfig } diff --git a/src/Microsoft.WSMan.Management/WSManConnections.cs b/src/Microsoft.WSMan.Management/WSManConnections.cs index a4e776bab5..92e31bd22c 100644 --- a/src/Microsoft.WSMan.Management/WSManConnections.cs +++ b/src/Microsoft.WSMan.Management/WSManConnections.cs @@ -259,7 +259,7 @@ namespace Microsoft.WSMan.Management { try { - //always in the format http://server:port/applicationname + // always in the format http://server:port/applicationname string[] constrsplit = connectionuri.OriginalString.Split(new string[] { ":" + port + "/" + applicationname }, StringSplitOptions.None); string[] constrsplit1 = constrsplit[0].Split(new string[] { "//" }, StringSplitOptions.None); computername = constrsplit1[1].Trim(); @@ -282,9 +282,9 @@ namespace Microsoft.WSMan.Management } helper.CreateWsManConnection(ParameterSetName, connectionuri, port, computername, applicationname, usessl.IsPresent, Authentication, sessionoption, Credential, CertificateThumbprint); - }//End BeginProcessing() + } - }//end class + } #endregion #region Disconnect-WSMAN @@ -331,7 +331,7 @@ namespace Microsoft.WSMan.Management void Dispose() { - //CleanUp(); + // CleanUp(); GC.SuppressFinalize(this); } /// @@ -378,8 +378,8 @@ namespace Microsoft.WSMan.Management { helper.AssertError(helper.GetResourceMsgFromResourcetext("InvalidComputerName"), false, computername); } - }//End BeginProcessing() + } - }//End Class + } #endregion Disconnect-WSMAN } diff --git a/src/Microsoft.WSMan.Management/WSManInstance.cs b/src/Microsoft.WSMan.Management/WSManInstance.cs index c264aa7bed..6a4afeb70e 100644 --- a/src/Microsoft.WSMan.Management/WSManInstance.cs +++ b/src/Microsoft.WSMan.Management/WSManInstance.cs @@ -404,7 +404,7 @@ namespace Microsoft.WSMan.Management string[] Split = filter.Trim().Split(new Char[] { '=', ';' }); if ((Split.Length)%2 != 0) { - //mismatched property name/value pair + // mismatched property name/value pair return null; } @@ -527,7 +527,7 @@ namespace Microsoft.WSMan.Management { try { - //in the format http(s)://server[:port/applicationname] + // in the format http(s)://server[:port/applicationname] string[] constrsplit = connectionuri.OriginalString.Split(new string[] { ":" + port + "/" + applicationname }, StringSplitOptions.None); string[] constrsplit1 = constrsplit[0].Split(new string[] { "//" }, StringSplitOptions.None); computername = constrsplit1[1].Trim(); @@ -604,7 +604,7 @@ namespace Microsoft.WSMan.Management void Dispose() { - //CleanUp(); + // CleanUp(); GC.SuppressFinalize(this); } /// @@ -912,7 +912,7 @@ namespace Microsoft.WSMan.Management { try { - //in the format http(s)://server[:port/applicationname] + // in the format http(s)://server[:port/applicationname] string[] constrsplit = connectionuri.OriginalString.Split(new string[] { ":" + port + "/" + applicationname }, StringSplitOptions.None); string[] constrsplit1 = constrsplit[0].Split(new string[] { "//" }, StringSplitOptions.None); computername = constrsplit1[1].Trim(); @@ -969,7 +969,7 @@ namespace Microsoft.WSMan.Management if (m_session != null) Dispose(m_session); } - }//End ProcessRecord() + } #region IDisposable Members @@ -980,7 +980,7 @@ namespace Microsoft.WSMan.Management void Dispose() { - //CleanUp(); + // CleanUp(); GC.SuppressFinalize(this); } /// @@ -1210,7 +1210,7 @@ namespace Microsoft.WSMan.Management { try { - //in the format http(s)://server[:port/applicationname] + // in the format http(s)://server[:port/applicationname] string[] constrsplit = connectionuri.OriginalString.Split(new string[] { ":" + port + "/" + applicationname }, StringSplitOptions.None); string[] constrsplit1 = constrsplit[0].Split(new string[] { "//" }, StringSplitOptions.None); computername = constrsplit1[1].Trim(); @@ -1252,7 +1252,7 @@ namespace Microsoft.WSMan.Management } - }//End ProcessRecord() + } #region IDisposable Members @@ -1263,7 +1263,7 @@ namespace Microsoft.WSMan.Management void Dispose() { - //CleanUp(); + // CleanUp(); GC.SuppressFinalize(this); } /// @@ -1504,7 +1504,7 @@ namespace Microsoft.WSMan.Management { try { - //in the format http(s)://server[:port/applicationname] + // in the format http(s)://server[:port/applicationname] string[] constrsplit = connectionuri.OriginalString.Split(new string[] { ":" + port + "/" + applicationname }, StringSplitOptions.None); string[] constrsplit1 = constrsplit[0].Split(new string[] { "//" }, StringSplitOptions.None); computername = constrsplit1[1].Trim(); @@ -1516,7 +1516,7 @@ namespace Microsoft.WSMan.Management } - }//End BeginProcessing() + } /// /// ProcessRecord method. @@ -1526,7 +1526,7 @@ namespace Microsoft.WSMan.Management try { IWSManResourceLocator m_resource = helper.InitializeResourceLocator(optionset, selectorset, null, null, m_wsmanObject, resourceuri); - //create the session object + // create the session object m_session = helper.CreateSessionObject(m_wsmanObject, Authentication, sessionoption, Credential, connectionStr, CertificateThumbprint, usessl.IsPresent); string rootNode = helper.GetRootNodeName(helper.WSManOp, m_resource.ResourceUri, null); string input = helper.ProcessInput(m_wsmanObject, filepath, helper.WSManOp, rootNode, valueset, m_resource, m_session); @@ -1561,7 +1561,7 @@ namespace Microsoft.WSMan.Management } } - }//End ProcessRecord() + } #region IDisposable Members @@ -1572,7 +1572,7 @@ namespace Microsoft.WSMan.Management void Dispose() { - //CleanUp(); + // CleanUp(); GC.SuppressFinalize(this); } /// @@ -1595,8 +1595,8 @@ namespace Microsoft.WSMan.Management { helper.CleanUp(); - }//End EndProcessing() - }//End Class + } + } #endregion } diff --git a/src/Microsoft.WSMan.Management/WsManHelper.cs b/src/Microsoft.WSMan.Management/WsManHelper.cs index 5a9832c86c..f6defb6ff2 100644 --- a/src/Microsoft.WSMan.Management/WsManHelper.cs +++ b/src/Microsoft.WSMan.Management/WsManHelper.cs @@ -23,12 +23,12 @@ namespace Microsoft.WSMan.Management [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "0#")] internal class WSManHelper { - //regular expressions + // regular expressions private const string PTRN_URI_LAST = @"([a-z_][-a-z0-9._]*)$"; private const string PTRN_OPT = @"^-([a-z]+):(.*)"; private const string PTRN_HASH_TOK = @"\s*([\w:]+)\s*=\s*(\$null|""([^""]*)"")\s*"; - //schemas + // schemas private const string URI_IPMI = @"http://schemas.dmtf.org/wbem/wscim/1/cim-schema"; private const string URI_WMI = @"http://schemas.microsoft.com/wbem/wsman/1/wmi"; private const string NS_IPMI = @"http://schemas.dmtf.org/wbem/wscim/1/cim-schema"; @@ -41,7 +41,7 @@ namespace Microsoft.WSMan.Management private const string ALIAS_XPATH = @"xpath"; private const string URI_XPATH_DIALECT = @"http://www.w3.org/TR/1999/REC-xpath-19991116"; - //credSSP strings + // credSSP strings internal string CredSSP_RUri = "winrm/config/client/auth"; internal string CredSSP_XMLNmsp = "http://schemas.microsoft.com/wbem/wsman/1/config/client/auth"; internal string CredSSP_SNode = "/cfg:Auth/cfg:CredSSP"; @@ -55,18 +55,18 @@ namespace Microsoft.WSMan.Management internal string Service_CredSSP_Uri = "winrm/config/service/auth"; internal string Service_CredSSP_XMLNmsp = "http://schemas.microsoft.com/wbem/wsman/1/config/service/auth"; - //gpo registry path and keys + // gpo registry path and keys internal string Registry_Path_Credentials_Delegation = @"SOFTWARE\Policies\Microsoft\Windows"; internal string Key_Allow_Fresh_Credentials = "AllowFreshCredentials"; internal string Key_Concatenate_Defaults_AllowFresh = "ConcatenateDefaults_AllowFresh"; internal string Delegate = "delegate"; internal string keyAllowcredssp = "AllowCredSSP"; - //'Constants for MS-XML + // 'Constants for MS-XML private const string NODE_ATTRIBUTE = "2"; private const int NODE_TEXT = 3; - //strings for dialects + // strings for dialects internal string ALIAS_WQL = @"wql"; internal string ALIAS_ASSOCIATION = @"association"; internal string ALIAS_SELECTOR = @"selector"; @@ -74,7 +74,7 @@ namespace Microsoft.WSMan.Management internal string URI_SELECTOR_DIALECT = @"http://schemas.dmtf.org/wbem/wsman/1/wsman/SelectorFilter"; internal string URI_ASSOCIATION_DIALECT = @" http://schemas.dmtf.org/wbem/wsman/1/cimbinding/associationFilter"; - //string for operation + // string for operation internal string WSManOp = null; private PSCmdlet cmdletname; @@ -87,7 +87,7 @@ namespace Microsoft.WSMan.Management // // - //Below class is just a static container which would release sessions in case this DLL is unloaded. + // Below class is just a static container which would release sessions in case this DLL is unloaded. internal class Sessions { /// @@ -120,7 +120,7 @@ namespace Microsoft.WSMan.Management } catch (ArgumentException) { - //Somehow the object was a null reference. Ignore the error + // Somehow the object was a null reference. Ignore the error } sessionobj=null; @@ -223,7 +223,7 @@ namespace Microsoft.WSMan.Management } catch (ArgumentException) { - //Somehow the object was a null reference. Ignore the error + // Somehow the object was a null reference. Ignore the error } Sessions.SessionObjCache.Remove(key); @@ -248,7 +248,7 @@ namespace Microsoft.WSMan.Management } catch (ArgumentException) { - //Somehow the object was a null reference. Ignore the error + // Somehow the object was a null reference. Ignore the error } Sessions.SessionObjCache.Remove(computer); @@ -312,7 +312,7 @@ namespace Microsoft.WSMan.Management } else { - //error + // error } } @@ -380,7 +380,7 @@ namespace Microsoft.WSMan.Management if (_fs != null) { - //_fs.Close(); + // _fs.Close(); _fs.Dispose(); } } @@ -393,7 +393,7 @@ namespace Microsoft.WSMan.Management string resultString = null; - //if file path is given + // if file path is given if (!string.IsNullOrEmpty(filepath) && valueset == null) { if (!File.Exists(filepath)) @@ -413,7 +413,7 @@ namespace Microsoft.WSMan.Management string parameters = null, nilns = null; string xmlns = GetXmlNs(resourceUri.ResourceUri); - //if valueset is given, i.e hashtable + // if valueset is given, i.e hashtable if (valueset != null) { foreach (DictionaryEntry entry in valueset) @@ -446,7 +446,7 @@ namespace Microsoft.WSMan.Management xpathString = @"/*/*[local-name()=""" + entry.Key + @"""]"; if (entry.Key.ToString().Equals("location", StringComparison.OrdinalIgnoreCase)) { - //'Ignore cim:Location + // 'Ignore cim:Location xpathString = @"/*/*[local-name()=""" + entry.Key + @""" and namespace-uri() != """ + NS_CIMBASE + @"""]"; } @@ -480,11 +480,11 @@ namespace Microsoft.WSMan.Management if (string.IsNullOrEmpty(entry.Key.ToString())) { - //XmlNode newnode = xmlfile.CreateNode(XmlNodeType.Attribute, ATTR_NIL_NAME, NS_XSI_URI); + // XmlNode newnode = xmlfile.CreateNode(XmlNodeType.Attribute, ATTR_NIL_NAME, NS_XSI_URI); XmlAttribute newnode = xmlfile.CreateAttribute(XmlNodeType.Attribute.ToString(), ATTR_NIL_NAME, NS_XSI_URI); newnode.Value = "true"; node.Attributes.Append(newnode); - //(newnode.Attributes.Item(0).FirstChild ); + // (newnode.Attributes.Item(0).FirstChild ); node.Value = string.Empty; } else @@ -494,11 +494,13 @@ namespace Microsoft.WSMan.Management } } - }//end for - }//end if valueset + } + } + resultString = xmlfile.OuterXml; break; - }//end switch + } + return resultString; } @@ -698,7 +700,7 @@ namespace Microsoft.WSMan.Management IWSManConnectionOptionsEx2 connObject = (IWSManConnectionOptionsEx2)wsmanObject.CreateConnectionOptions(); if (credential != null) { - //connObject = (IWSManConnectionOptionsEx2)wsmanObject.CreateConnectionOptions(); + // connObject = (IWSManConnectionOptionsEx2)wsmanObject.CreateConnectionOptions(); System.Net.NetworkCredential nwCredential = new System.Net.NetworkCredential(); if (credential.UserName != null) { @@ -810,7 +812,7 @@ namespace Microsoft.WSMan.Management } else { - //If UseUtf16 is false, then default Encoding is Utf8 + // If UseUtf16 is false, then default Encoding is Utf8 sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagUtf8; } @@ -826,7 +828,7 @@ namespace Microsoft.WSMan.Management } else { - //If SessionOption is null then, default Encoding is Utf8 + // If SessionOption is null then, default Encoding is Utf8 sessionFlags = sessionFlags | (int)WSManSessionFlags.WSManFlagUtf8; } @@ -961,7 +963,7 @@ namespace Microsoft.WSMan.Management string connectionStr = CreateConnectionString(connectionuri, port, computername, applicationname); if (connectionuri != null) { - //in the format http(s)://server[:port/applicationname] + // in the format http(s)://server[:port/applicationname] string[] constrsplit = connectionStr.Split(new string[] { ":" + port + "/" + applicationname }, StringSplitOptions.None); string[] constrsplit1 = constrsplit[0].Split(new string[] { "//" }, StringSplitOptions.None); computername = constrsplit1[1].Trim(); @@ -1134,7 +1136,7 @@ namespace Microsoft.WSMan.Management /// internal static string GetResourceString(string Key) { - //Checks whether resource values already loaded and loads. + // Checks whether resource values already loaded and loads. if (ResourceValueCache.Count <= 0) { LoadResourceData(); diff --git a/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs b/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs index 95875c0bc9..e7cdc3debd 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs @@ -269,7 +269,7 @@ namespace System.Management.Automation if (!isAssemblyFileFound || !isAssemblyFileMatching) { #if !UNIX - //Try loading from GAC + // Try loading from GAC if (!TryFindInGAC(assemblyName, out asmFilePath)) { return null; @@ -316,13 +316,13 @@ namespace System.Management.Automation if (string.IsNullOrEmpty(_winDir)) { - //cache value of '_winDir' folder in member variable. + // cache value of '_winDir' folder in member variable. _winDir = Environment.GetEnvironmentVariable("winDir"); } if (string.IsNullOrEmpty(_gacPathMSIL)) { - //cache value of '_gacPathMSIL' folder in member variable. + // cache value of '_gacPathMSIL' folder in member variable. _gacPathMSIL = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_MSIL"; } @@ -336,7 +336,7 @@ namespace System.Management.Automation { if (string.IsNullOrEmpty(_gacPath64)) { - //cache value of '_gacPath64' folder in member variable. + // cache value of '_gacPath64' folder in member variable. _gacPath64 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_64"; } @@ -346,7 +346,7 @@ namespace System.Management.Automation { if (string.IsNullOrEmpty(_gacPath32)) { - //cache value of '_gacPath32' folder in member variable. + // cache value of '_gacPath32' folder in member variable. _gacPath32 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_32"; } @@ -370,12 +370,12 @@ namespace System.Management.Automation if (Directory.Exists(tempAssemblyDirPath)) { - //Enumerate all directories, sort by name and select the last. This selects the latest version. + // Enumerate all directories, sort by name and select the last. This selects the latest version. var chosenVersionDirectory = Directory.GetDirectories(tempAssemblyDirPath).OrderBy(d => d).LastOrDefault(); if (!string.IsNullOrEmpty(chosenVersionDirectory)) { - //Select first or default as the directory will contain only one assembly. If nothing then default is null; + // Select first or default as the directory will contain only one assembly. If nothing then default is null; var foundAssemblyPath = Directory.GetFiles(chosenVersionDirectory, $"{assemblyName.Name}*").FirstOrDefault(); if (!string.IsNullOrEmpty(foundAssemblyPath)) diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 99195cc430..a44d9229dd 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -235,7 +235,7 @@ namespace System.Management.Automation /// public static string SelectProductNameForDirectory(Platform.XDG_Type dirpath) { - //TODO: XDG_DATA_DIRS implementation as per GitHub issue #1060 + // TODO: XDG_DATA_DIRS implementation as per GitHub issue #1060 string xdgconfighome = System.Environment.GetEnvironmentVariable("XDG_CONFIG_HOME"); string xdgdatahome = System.Environment.GetEnvironmentVariable("XDG_DATA_HOME"); @@ -254,10 +254,10 @@ namespace System.Management.Automation switch (dirpath) { case Platform.XDG_Type.CONFIG: - //the user has set XDG_CONFIG_HOME corresponding to profile path + // the user has set XDG_CONFIG_HOME corresponding to profile path if (string.IsNullOrEmpty(xdgconfighome)) { - //xdg values have not been set + // xdg values have not been set return xdgConfigHomeDefault; } @@ -267,7 +267,7 @@ namespace System.Management.Automation } case Platform.XDG_Type.DATA: - //the user has set XDG_DATA_HOME corresponding to module path + // the user has set XDG_DATA_HOME corresponding to module path if (string.IsNullOrEmpty(xdgdatahome)) { // create the xdg folder if needed @@ -279,7 +279,7 @@ namespace System.Management.Automation } catch (UnauthorizedAccessException) { - //service accounts won't have permission to create user folder + // service accounts won't have permission to create user folder return GetTemporaryDirectory(); } } @@ -292,11 +292,11 @@ namespace System.Management.Automation } case Platform.XDG_Type.USER_MODULES: - //the user has set XDG_DATA_HOME corresponding to module path + // the user has set XDG_DATA_HOME corresponding to module path if (string.IsNullOrEmpty(xdgdatahome)) { - //xdg values have not been set - if (!Directory.Exists(xdgModuleDefault)) //module folder not always guaranteed to exist + // xdg values have not been set + if (!Directory.Exists(xdgModuleDefault)) // module folder not always guaranteed to exist { try { @@ -304,7 +304,7 @@ namespace System.Management.Automation } catch (UnauthorizedAccessException) { - //service accounts won't have permission to create user folder + // service accounts won't have permission to create user folder return GetTemporaryDirectory(); } } @@ -320,11 +320,11 @@ namespace System.Management.Automation return "/usr/local/share/powershell/Modules"; case Platform.XDG_Type.CACHE: - //the user has set XDG_CACHE_HOME + // the user has set XDG_CACHE_HOME if (string.IsNullOrEmpty(xdgcachehome)) { - //xdg values have not been set - if (!Directory.Exists(xdgCacheDefault)) //module folder not always guaranteed to exist + // xdg values have not been set + if (!Directory.Exists(xdgCacheDefault)) // module folder not always guaranteed to exist { try { @@ -332,7 +332,7 @@ namespace System.Management.Automation } catch (UnauthorizedAccessException) { - //service accounts won't have permission to create user folder + // service accounts won't have permission to create user folder return GetTemporaryDirectory(); } } @@ -350,7 +350,7 @@ namespace System.Management.Automation } catch (UnauthorizedAccessException) { - //service accounts won't have permission to create user folder + // service accounts won't have permission to create user folder return GetTemporaryDirectory(); } } @@ -359,12 +359,12 @@ namespace System.Management.Automation } case Platform.XDG_Type.DEFAULT: - //default for profile location + // default for profile location return xdgConfigHomeDefault; default: - //xdgConfigHomeDefault needs to be created in the edge case that we do not have the folder or it was deleted - //This folder is the default in the event of all other failures for data storage + // xdgConfigHomeDefault needs to be created in the edge case that we do not have the folder or it was deleted + // This folder is the default in the event of all other failures for data storage if (!Directory.Exists(xdgConfigHomeDefault)) { try diff --git a/src/System.Management.Automation/DscSupport/CimDSCParser.cs b/src/System.Management.Automation/DscSupport/CimDSCParser.cs index 327c3d572f..34e809d163 100644 --- a/src/System.Management.Automation/DscSupport/CimDSCParser.cs +++ b/src/System.Management.Automation/DscSupport/CimDSCParser.cs @@ -421,7 +421,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration string className = c.CimSystemProperties.ClassName; if ((superClassName != null) && (superClassName.Equals("OMI_BaseResource", StringComparison.OrdinalIgnoreCase))) { - //Get the name of the file without schema.mof extension + // Get the name of the file without schema.mof extension if (!(className.Equals(fileNameDefiningClass, StringComparison.OrdinalIgnoreCase))) { PSInvalidOperationException e = PSTraceSource.NewInvalidOperationException( @@ -486,7 +486,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal private const int IndexModuleVersion = 1; private const int IndexClassName = 2; - //Create a list of classes which are not actual DSC resources similar to what we do inside PSDesiredStateConfiguration.psm1 + // Create a list of classes which are not actual DSC resources similar to what we do inside PSDesiredStateConfiguration.psm1 private static readonly string[] s_hiddenResourceList = { "MSFT_BaseConfigurationProviderRegistration", @@ -494,12 +494,12 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal "MSFT_PSConfigurationProviderRegistration", }; - //Create a HashSet for fast lookup. According to MSDN, the time complexity of search for an element in a HashSet is O(1) + // Create a HashSet for fast lookup. According to MSDN, the time complexity of search for an element in a HashSet is O(1) private static readonly HashSet s_hiddenResourceCache = new HashSet(s_hiddenResourceList, StringComparer.OrdinalIgnoreCase); - //a collection to hold current importing script based resource file - //this prevent circular importing case when the script resource existing in the same module with resources it import-dscresource + // a collection to hold current importing script based resource file + // this prevent circular importing case when the script resource existing in the same module with resources it import-dscresource private static readonly HashSet s_currentImportingScriptFiles = new HashSet(StringComparer.OrdinalIgnoreCase); /// @@ -871,7 +871,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal return null; } - //Callback implementation... + // Callback implementation... private static CimClass MyClassCallback(string serverName, string namespaceName, string className) { foreach (KeyValuePair> cimClass in ClassCache) @@ -1217,7 +1217,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal } catch (Microsoft.Management.Infrastructure.CimException) { - //exception means no DSCAlias + // exception means no DSCAlias } return null; @@ -2514,7 +2514,7 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal return false; } - //BUGBUG - need to fix up how the module gets set. + // BUGBUG - need to fix up how the module gets set. Token[] tokens; ParseError[] errors; var ast = Parser.ParseFile(fileName, out tokens, out errors); @@ -3260,8 +3260,8 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal if (!ScriptKeywordFileCache.Contains(schemaFilePath)) { // Parsing the file is all that needs to be done to add the keywords - //BUGBUG - need to fix up how the module gets set. - //BUGBUG - should fail somehow if errors is not empty + // BUGBUG - need to fix up how the module gets set. + // BUGBUG - should fail somehow if errors is not empty Token[] tokens; ParseError[] errors; s_currentImportingScriptFiles.Add(schemaFilePath); Parser.ParseFile(schemaFilePath, out tokens, out errors); diff --git a/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs b/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs index ff9eda6d84..5879844301 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/BaseOutputtingCommand.cs @@ -122,7 +122,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { object o = _formatObjectDeserializer.Deserialize(so); - //Console.WriteLine("OutCommandInner.Execute() retrieved object {0}, of type {1}", o.ToString(), o.GetType()); + // Console.WriteLine("OutCommandInner.Execute() retrieved object {0}, of type {1}", o.ToString(), o.GetType()); if (NeedsPreprocessing(o)) { return false; @@ -160,7 +160,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } } - //Console.WriteLine("OutCommandInner.Execute() calling ctxManager.Process({0})",o.ToString()); + // Console.WriteLine("OutCommandInner.Execute() calling ctxManager.Process({0})",o.ToString()); List info = _cache.Add((PacketInfoData)o); if (info != null) @@ -460,7 +460,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format /// Current context, with Fs in it. private void ProcessFormatEnd(FormatEndData fe, FormatMessagesContextManager.OutputContext c) { - //Console.WriteLine("ProcessFormatEnd"); + // Console.WriteLine("ProcessFormatEnd"); // we just add an empty line to the display this.LineOutput.WriteLine(string.Empty); } @@ -471,7 +471,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format /// The context containing the Gs entry. private void ProcessGroupStart(FormatMessagesContextManager.OutputContext c) { - //Console.WriteLine("ProcessGroupStart"); + // Console.WriteLine("ProcessGroupStart"); GroupOutputContext goc = (GroupOutputContext)c; if (goc.Data.groupingEntry != null) @@ -493,7 +493,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format /// Current context, with Gs in it. private void ProcessGroupEnd(GroupEndData ge, FormatMessagesContextManager.OutputContext c) { - //Console.WriteLine("ProcessGroupEnd"); + // Console.WriteLine("ProcessGroupEnd"); GroupOutputContext goc = (GroupOutputContext)c; goc.GroupEnd(); diff --git a/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs b/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs index b1f77b7c0d..8bcbe7bee7 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs @@ -165,7 +165,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format followingLinesWidth += firstLineIndentation; } - //error checking on invalid values + // error checking on invalid values // generate the lines using the computed widths StringCollection sc = StringManipulationHelper.GenerateLines(_lo.DisplayCells, _stringBuffer.ToString(), diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs index 5c1d0f8ce0..8b6a590009 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/XmlLoaderBase.cs @@ -79,7 +79,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format internal class XmlLoaderLogger : IDisposable { #region tracer - //PSS/end-user tracer + // PSS/end-user tracer [TraceSource("FormatFileLoading", "Loading format files")] private static PSTraceSource s_formatFileLoadingtracer = PSTraceSource.GetTracer("FormatFileLoading", "Loading format files", false); @@ -328,7 +328,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (n.ChildNodes[0] is XmlText) return true; } - //Error at XPath {0} in file {1}: Node {2} cannot have children. + // Error at XPath {0} in file {1}: Node {2} cannot have children. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoChildrenAllowed, ComputeCurrentXPath(), FilePath, n.Name)); return false; } @@ -389,7 +389,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format XmlElement e = n as XmlElement; if (e != null && e.Attributes.Count > 0) { - //Error at XPath {0} in file {1}: The XML Element {2} does not allow attributes. + // Error at XPath {0} in file {1}: The XML Element {2} does not allow attributes. ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.AttributesNotAllowed, ComputeCurrentXPath(), FilePath, n.Name)); } } @@ -430,62 +430,62 @@ namespace Microsoft.PowerShell.Commands.Internal.Format internal void ProcessDuplicateNode(XmlNode n) { - //Error at XPath {0} in file {1}: Duplicated node. + // Error at XPath {0} in file {1}: Duplicated node. ReportLogEntryHelper(StringUtil.Format(FormatAndOutXmlLoadingStrings.DuplicatedNode, ComputeCurrentXPath(), FilePath), XmlLoaderLoggerEntry.EntryType.Error); } internal void ProcessDuplicateAlternateNode(string node1, string node2) { - //Error at XPath {0} in file {1}: {2} and {3} are mutually exclusive. + // Error at XPath {0} in file {1}: {2} and {3} are mutually exclusive. ReportLogEntryHelper(StringUtil.Format(FormatAndOutXmlLoadingStrings.MutuallyExclusiveNode, ComputeCurrentXPath(), FilePath, node1, node2), XmlLoaderLoggerEntry.EntryType.Error); } internal void ProcessDuplicateAlternateNode(XmlNode n, string node1, string node2) { - //Error at XPath {0} in file {1}: {2}, {3} and {4} are mutually exclusive. + // Error at XPath {0} in file {1}: {2}, {3} and {4} are mutually exclusive. ReportLogEntryHelper(StringUtil.Format(FormatAndOutXmlLoadingStrings.ThreeMutuallyExclusiveNode, ComputeCurrentXPath(), FilePath, n.Name, node1, node2), XmlLoaderLoggerEntry.EntryType.Error); } private void ReportIllegalXmlNode(XmlNode n) { - //UnknownNode=Error at XPath {0} in file {1}: {2} is an unknown node. + // UnknownNode=Error at XPath {0} in file {1}: {2} is an unknown node. ReportLogEntryHelper(StringUtil.Format(FormatAndOutXmlLoadingStrings.UnknownNode, ComputeCurrentXPath(), FilePath, n.Name), XmlLoaderLoggerEntry.EntryType.Error); } private void ReportIllegalXmlAttribute(XmlAttribute a) { - //Error at XPath {0} in file {1}: {2} is an unknown attribute. + // Error at XPath {0} in file {1}: {2} is an unknown attribute. ReportLogEntryHelper(StringUtil.Format(FormatAndOutXmlLoadingStrings.UnknownAttribute, ComputeCurrentXPath(), FilePath, a.Name), XmlLoaderLoggerEntry.EntryType.Error); } protected void ReportMissingAttribute(string name) { - //Error at XPath {0} in file {1}: {2} is a missing attribute. + // Error at XPath {0} in file {1}: {2} is a missing attribute. ReportLogEntryHelper(StringUtil.Format(FormatAndOutXmlLoadingStrings.MissingAttribute, ComputeCurrentXPath(), FilePath, name), XmlLoaderLoggerEntry.EntryType.Error); } protected void ReportMissingNode(string name) { - //Error at XPath {0} in file {1}: Missing Node {2}. + // Error at XPath {0} in file {1}: Missing Node {2}. ReportLogEntryHelper(StringUtil.Format(FormatAndOutXmlLoadingStrings.MissingNode, ComputeCurrentXPath(), FilePath, name), XmlLoaderLoggerEntry.EntryType.Error); } protected void ReportMissingNodes(string[] names) { - //Error at XPath {0} in file {1}: Missing Node from {2}. + // Error at XPath {0} in file {1}: Missing Node from {2}. string namesString = string.Join(", ", names); ReportLogEntryHelper(StringUtil.Format(FormatAndOutXmlLoadingStrings.MissingNodeFromList, ComputeCurrentXPath(), FilePath, namesString), XmlLoaderLoggerEntry.EntryType.Error); } protected void ReportEmptyNode(XmlNode n) { - //Error at XPath {0} in file {1}: {2} is an empty node. + // Error at XPath {0} in file {1}: {2} is an empty node. ReportLogEntryHelper(StringUtil.Format(FormatAndOutXmlLoadingStrings.EmptyNode, ComputeCurrentXPath(), FilePath, n.Name), XmlLoaderLoggerEntry.EntryType.Error); } protected void ReportEmptyAttribute(XmlAttribute a) { - //EmptyAttribute=Error at XPath {0} in file {1}: {2} is an empty attribute. + // EmptyAttribute=Error at XPath {0} in file {1}: {2} is an empty attribute. ReportLogEntryHelper(StringUtil.Format(FormatAndOutXmlLoadingStrings.EmptyAttribute, ComputeCurrentXPath(), FilePath, a.Name), XmlLoaderLoggerEntry.EntryType.Error); } diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs index 5ada1cfc90..edf5a842eb 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/displayDescriptionData.cs @@ -71,7 +71,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { Nullable y = x; this._value = y; - //this._value = (Nullable)x; + // this._value = (Nullable)x; } internal T Value @@ -469,7 +469,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format internal sealed partial class AppliesTo { - //it can contain either a type or type group reference + // it can contain either a type or type group reference internal List referenceList = new List(); } diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs index 37ef888425..eec0efca2b 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs @@ -251,7 +251,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } catch (Exception e) // will rethrow { - //Error in file {0}: {1} + // Error in file {0}: {1} this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ErrorInFile, FilePath, e.Message)); throw; @@ -312,7 +312,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } catch (Exception e) // will rethrow { - //Error in formatting data "{0}": {1} + // Error in formatting data "{0}": {1} this.ReportErrorForLoadingFromObjectModel( StringUtil.Format(FormatAndOutXmlLoadingStrings.ErrorInFormattingData, typeDefinition.TypeName, e.Message), typeDefinition.TypeName); @@ -565,7 +565,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (tableBody.header.columnHeaderDefinitionList.Count != tableBody.defaultDefinition.rowItemDefinitionList.Count) { - //Error at XPath {0} in file {1}: Header item count = {2} does not match default row item count = {3}. + // Error at XPath {0} in file {1}: Header item count = {2} does not match default row item count = {3}. this.ReportErrorForLoadingFromObjectModel( StringUtil.Format(FormatAndOutXmlLoadingStrings.IncorrectHeaderItemCountInFormattingData, typeName, viewIndex, tableBody.header.columnHeaderDefinitionList.Count, @@ -818,7 +818,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - //Error at XPath {0} in file {1}: There cannot be more than one default {2}. + // Error at XPath {0} in file {1}: There cannot be more than one default {2}. this.ReportErrorForLoadingFromObjectModel( StringUtil.Format(FormatAndOutXmlLoadingStrings.TooManyDefaultShapeEntryInFormattingData, typeName, viewIndex, XmlTags.ListEntryNode), typeName); listBody.defaultEntryDefinition = null; @@ -911,11 +911,11 @@ namespace Microsoft.PowerShell.Commands.Internal.Format // we must have at least a definition in th elist if (lved.itemDefinitionList.Count == 0) { - //Error: At least one list view item must be specified. + // Error: At least one list view item must be specified. this.ReportErrorForLoadingFromObjectModel( StringUtil.Format(FormatAndOutXmlLoadingStrings.NoListViewItemInFormattingData, typeName, viewIndex), typeName); lved.itemDefinitionList = null; - return; //fatal + return; // fatal } } @@ -981,7 +981,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - //Error at XPath {0} in file {1}: There cannot be more than one default {2}. + // Error at XPath {0} in file {1}: There cannot be more than one default {2}. this.ReportErrorForLoadingFromObjectModel( StringUtil.Format(FormatAndOutXmlLoadingStrings.TooManyDefaultShapeEntryInFormattingData, typeName, viewIndex, XmlTags.WideEntryNode), typeName); wideBody.defaultEntryDefinition = null; @@ -1194,7 +1194,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - //Error at XPath {0} in file {1}: Invalid {2} value. + // Error at XPath {0} in file {1}: Invalid {2} value. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidNodeValue, ComputeCurrentXPath(), FilePath, XmlTags.PropertyCountForTableNode)); } } @@ -1212,7 +1212,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - //Error at XPath {0} in file {1}: Invalid {2} value. + // Error at XPath {0} in file {1}: Invalid {2} value. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidNodeValue, ComputeCurrentXPath(), FilePath, XmlTags.MultilineTablesNode)); } } @@ -1249,7 +1249,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format EnumerableExpansionDirective eed = LoadEnumerableExpansionDirective(n, k++); if (eed == null) { - //Error at XPath {0} in file {1}: {2} failed to load. + // Error at XPath {0} in file {1}: {2} failed to load. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.EnumerableExpansionNode)); return null; // fatal error } @@ -1282,7 +1282,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (appliesToNodeFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } appliesToNodeFound = true; @@ -1293,22 +1293,22 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (expandNodeFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } expandNodeFound = true; string s = GetMandatoryInnerText(n); if (s == null) { - return null; //fatal + return null; // fatal } bool success = EnumerableExpansionConversion.Convert(s, out eed.enumerableExpansion); if (!success) { - //Error at XPath {0} in file {1}: Invalid {2} value. + // Error at XPath {0} in file {1}: Invalid {2} value. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidNodeValue, ComputeCurrentXPath(), FilePath, XmlTags.ExpandNode)); - return null; //fatal + return null; // fatal } } else @@ -1473,7 +1473,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (appliesTo.referenceList.Count == 0) { // we do not accept an empty list - //Error at XPath {0} in file {1}: No type or condition is specified for applying the view. + // Error at XPath {0} in file {1}: No type or condition is specified for applying the view. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.EmptyAppliesTo, ComputeCurrentXPath(), FilePath)); return null; } @@ -1584,7 +1584,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (typeFound && typeGroupFound) { - //Error at XPath {0} in file {1}: Cannot have SelectionSetName and TypeName at the same time. + // Error at XPath {0} in file {1}: Cannot have SelectionSetName and TypeName at the same time. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.SelectionSetNameAndTypeName, ComputeCurrentXPath(), FilePath)); return null; // fatal error } @@ -1608,7 +1608,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format return retVal; } // failure: expression is mandatory - //Error at XPath {0} in file {1}: An expression is expected. + // Error at XPath {0} in file {1}: An expression is expected. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ExpectExpression, ComputeCurrentXPath(), FilePath)); return null; } @@ -1683,7 +1683,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (controlFound && labelFound) { - //Error at XPath {0} in file {1}: Cannot have control and label at the same time. + // Error at XPath {0} in file {1}: Cannot have control and label at the same time. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ControlAndLabel, ComputeCurrentXPath(), FilePath)); return null; // fatal error } @@ -1692,7 +1692,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { if (!expressionNodeFound) { - //Error at XPath {0} in file {1}: Cannot have control or label without an expression. + // Error at XPath {0} in file {1}: Cannot have control or label without an expression. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ControlLabelWithoutExpression, ComputeCurrentXPath(), FilePath)); return null; // fatal error } @@ -1721,7 +1721,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } // failure: expression is mandatory - //Error at XPath {0} in file {1}: An expression is expected. + // Error at XPath {0} in file {1}: An expression is expected. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ExpectExpression, ComputeCurrentXPath(), FilePath)); return null; } @@ -1767,7 +1767,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (e == null) { - //Error at XPath {0} in file {1}: Node should be an XmlElement. + // Error at XPath {0} in file {1}: Node should be an XmlElement. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NonXmlElementNode, ComputeCurrentXPath(), FilePath)); return false; } @@ -1868,7 +1868,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format break; case DisplayResourceManagerCache.AssemblyBindingStatus.FoundInGac: { - //"(Global Assembly Cache) {0}" + // "(Global Assembly Cache) {0}" assemblyDisplayName = StringUtil.Format(FormatAndOutXmlLoadingStrings.AssemblyInGAC, resource.assemblyName); } @@ -1886,21 +1886,21 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { case DisplayResourceManagerCache.LoadingResult.AssemblyNotFound: { - //Error at XPath {0} in file {1}: Assembly {2} is not found. + // Error at XPath {0} in file {1}: Assembly {2} is not found. msg = StringUtil.Format(FormatAndOutXmlLoadingStrings.AssemblyNotFound, ComputeCurrentXPath(), FilePath, assemblyDisplayName); } break; case DisplayResourceManagerCache.LoadingResult.ResourceNotFound: { - //Error at XPath {0} in file {1}: Resource {2} in assembly {3} is not found. + // Error at XPath {0} in file {1}: Resource {2} in assembly {3} is not found. msg = StringUtil.Format(FormatAndOutXmlLoadingStrings.ResourceNotFound, ComputeCurrentXPath(), FilePath, resource.baseName, assemblyDisplayName); } break; case DisplayResourceManagerCache.LoadingResult.StringNotFound: { - //Error at XPath {0} in file {1}: String {2} from resource {3} in assembly {4} is not found. + // Error at XPath {0} in file {1}: String {2} from resource {3} in assembly {4} is not found. msg = StringUtil.Format(FormatAndOutXmlLoadingStrings.StringResourceNotFound, ComputeCurrentXPath(), FilePath, resource.resourceId, resource.baseName, assemblyDisplayName); } @@ -1928,7 +1928,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } catch (ParseException e) { - //Error at XPath {0} in file {1}: Invalid script block "{2}". + // Error at XPath {0} in file {1}: Invalid script block "{2}". this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidScriptBlock, ComputeCurrentXPath(), FilePath, e.Message)); return false; } @@ -1973,7 +1973,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format _token.expressionValue = _loader.GetMandatoryInnerText(n); if (_token.expressionValue == null) { - //Error at XPath {0} in file {1}: Missing property. + // Error at XPath {0} in file {1}: Missing property. _loader.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoProperty, _loader.ComputeCurrentXPath(), _loader.FilePath)); _fatalError = true; return false; // fatal error @@ -1997,7 +1997,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format _token.expressionValue = _loader.GetMandatoryInnerText(n); if (_token.expressionValue == null) { - //Error at XPath {0} in file {1}: Missing script block text. + // Error at XPath {0} in file {1}: Missing script block text. _loader.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoScriptBlockText, _loader.ComputeCurrentXPath(), _loader.FilePath)); _fatalError = true; return false; // fatal error @@ -2090,7 +2090,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format formatString = _loader.GetMandatoryInnerText(n); if (formatString == null) { - //Error at XPath {0} in file {1}: Missing a format string. + // Error at XPath {0} in file {1}: Missing a format string. _loader.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoFormatString, _loader.ComputeCurrentXPath(), _loader.FilePath)); return false; // fatal error } @@ -2107,7 +2107,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format textToken = _loader.LoadText(n); if (textToken == null) { - //Error at XPath {0} in file {1}: Invalid {2}. + // Error at XPath {0} in file {1}: Invalid {2}. _loader.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidNode, _loader.ComputeCurrentXPath(), _loader.FilePath, XmlTags.TextNode)); return false; // fatal error } @@ -2124,7 +2124,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format // RULE: cannot have a text node and an expression at the same time if (textNodeFound) { - //Error at XPath {0} in file {1}: {2} cannot be specified with an expression. + // Error at XPath {0} in file {1}: {2} cannot be specified with an expression. _loader.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NodeWithExpression, _loader.ComputeCurrentXPath(), _loader.FilePath, XmlTags.TextNode)); return false; // fatal error @@ -2149,7 +2149,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format // RULE: we cannot have a format string without an expression node if (formatStringNodeFound) { - //Error at XPath {0} in file {1}: {2} cannot be specified without an expression. + // Error at XPath {0} in file {1}: {2} cannot be specified without an expression. _loader.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NodeWithoutExpression, _loader.ComputeCurrentXPath(), _loader.FilePath, XmlTags.FormatStringNode)); return false; // fatal error diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Complex.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Complex.cs index afef6336d7..0827f3c045 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Complex.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Complex.cs @@ -70,7 +70,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format ComplexControlEntryDefinition cced = LoadComplexControlEntryDefinition(n, entryIndex++); if (cced == null) { - //Error at XPath {0} in file {1}: {2} failed to load. + // Error at XPath {0} in file {1}: {2} failed to load. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.ComplexEntryNode)); complexBody.defaultEntry = null; return; // fatal error @@ -84,7 +84,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - //Error at XPath {0} in file {1}: There cannot be more than one default {2}. + // Error at XPath {0} in file {1}: There cannot be more than one default {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.TooManyDefaultShapeEntry, ComputeCurrentXPath(), FilePath, XmlTags.ComplexEntryNode)); complexBody.defaultEntry = null; return; // fatal error @@ -103,7 +103,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (complexBody.defaultEntry == null) { - //Error at XPath {0} in file {1}: There must be at least one default {2}. + // Error at XPath {0} in file {1}: There must be at least one default {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoDefaultShapeEntry, ComputeCurrentXPath(), FilePath, XmlTags.ComplexEntryNode)); } } @@ -125,7 +125,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (appliesToNodeFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } appliesToNodeFound = true; @@ -138,7 +138,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (bodyNodeFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } bodyNodeFound = true; @@ -152,7 +152,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (cced.itemDefinition.formatTokenList == null) { - //MissingNode=Error at XPath {0} in file {1}: Missing Node {2}. + // MissingNode=Error at XPath {0} in file {1}: Missing Node {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.MissingNode, ComputeCurrentXPath(), FilePath, XmlTags.ComplexItemNode)); return null; } @@ -180,7 +180,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (cpt == null) { - //Error at XPath {0} in file {1}: {2} failed to load. + // Error at XPath {0} in file {1}: {2} failed to load. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.ExpressionBindingNode)); return null; } @@ -193,7 +193,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (nlt == null) { - //Error at XPath {0} in file {1}: {2} failed to load. + // Error at XPath {0} in file {1}: {2} failed to load. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.NewLineNode)); return null; } @@ -206,7 +206,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (tt == null) { - //Error at XPath {0} in file {1}: {2} failed to load. + // Error at XPath {0} in file {1}: {2} failed to load. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.TextNode)); return null; } @@ -219,7 +219,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (frame == null) { - //Error at XPath {0} in file {1}: {2} failed to load. + // Error at XPath {0} in file {1}: {2} failed to load. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.FrameNode)); return null; } @@ -234,7 +234,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (formatTokenList.Count == 0) { - //Error at XPath {0} in file {1}: Empty custom control token list. + // Error at XPath {0} in file {1}: Empty custom control token list. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.EmptyCustomControlList, ComputeCurrentXPath(), FilePath)); return null; } @@ -471,14 +471,14 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (val == null) { - //Error at XPath {0} in file {1}: Missing inner text value. + // Error at XPath {0} in file {1}: Missing inner text value. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.MissingInnerText, ComputeCurrentXPath(), FilePath)); return retVal; } if (!int.TryParse(val, out retVal)) { - //Error at XPath {0} in file {1}: An integer is expected. + // Error at XPath {0} in file {1}: An integer is expected. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ExpectInteger, ComputeCurrentXPath(), FilePath)); return retVal; } @@ -497,7 +497,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format { if (val < 0) { - //Error at XPath {0} in file {1}: A non-negative integer is expected. + // Error at XPath {0} in file {1}: A non-negative integer is expected. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ExpectNaturalNumber, ComputeCurrentXPath(), FilePath)); success = false; } @@ -528,7 +528,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (leftIndentFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } leftIndentFound = true; @@ -543,7 +543,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (rightIndentFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } rightIndentFound = true; @@ -588,7 +588,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (itemNodeFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } itemNodeFound = true; @@ -608,7 +608,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (frame.itemDefinition.formatTokenList == null) { - //MissingNode=Error at XPath {0} in file {1}: Missing Node {2}. + // MissingNode=Error at XPath {0} in file {1}: Missing Node {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.MissingNode, ComputeCurrentXPath(), FilePath, XmlTags.ComplexItemNode)); return null; } @@ -644,7 +644,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format val = true; return true; } - //Error at XPath {0} in file {1}: A Boolean value is expected. + // Error at XPath {0} in file {1}: A Boolean value is expected. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ExpectBoolean, ComputeCurrentXPath(), FilePath)); return false; diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_List.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_List.cs index b99b6687f0..1061c0e0a5 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_List.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_List.cs @@ -69,7 +69,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format ListControlEntryDefinition lved = LoadListControlEntryDefinition(n, entryIndex++); if (lved == null) { - //Error at XPath {0} in file {1}: {2} failed to load. + // Error at XPath {0} in file {1}: {2} failed to load. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.ListEntryNode)); listBody.defaultEntryDefinition = null; return; // fatal error @@ -83,7 +83,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - //Error at XPath {0} in file {1}: There cannot be more than one default {2}. + // Error at XPath {0} in file {1}: There cannot be more than one default {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.TooManyDefaultShapeEntry, ComputeCurrentXPath(), FilePath, XmlTags.ListEntryNode)); listBody.defaultEntryDefinition = null; return; // fatal error @@ -102,7 +102,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (listBody.optionalEntryList == null) { - //Error at XPath {0} in file {1}: There must be at least one default {2}. + // Error at XPath {0} in file {1}: There must be at least one default {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoDefaultShapeEntry, ComputeCurrentXPath(), FilePath, XmlTags.ListEntryNode)); } } @@ -124,7 +124,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (appliesToNodeFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } appliesToNodeFound = true; @@ -137,7 +137,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (bodyNodeFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } bodyNodeFound = true; @@ -151,7 +151,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (lved.itemDefinitionList == null) { - //Error at XPath {0} in file {1}: Missing definition list. + // Error at XPath {0} in file {1}: Missing definition list. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoDefinitionList, ComputeCurrentXPath(), FilePath)); return null; } @@ -174,10 +174,10 @@ namespace Microsoft.PowerShell.Commands.Internal.Format ListControlItemDefinition lvid = LoadListControlItemDefinition(n); if (lvid == null) { - //Error at XPath {0} in file {1}: Invalid property entry. + // Error at XPath {0} in file {1}: Invalid property entry. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidPropertyEntry, ComputeCurrentXPath(), FilePath)); lved.itemDefinitionList = null; - return; //fatal + return; // fatal } lved.itemDefinitionList.Add(lvid); @@ -191,10 +191,10 @@ namespace Microsoft.PowerShell.Commands.Internal.Format // we must have at least a definition in th elist if (lved.itemDefinitionList.Count == 0) { - //Error at XPath {0} in file {1}: At least one list view item must be specified. + // Error at XPath {0} in file {1}: At least one list view item must be specified. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoListViewItem, ComputeCurrentXPath(), FilePath)); lved.itemDefinitionList = null; - return; //fatal + return; // fatal } } } diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Table.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Table.cs index 206f6825cf..2a74e20095 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Table.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Table.cs @@ -37,7 +37,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format hideHeadersNodeFound = true; if (!this.ReadBooleanNode(n, out tableBody.header.hideHeader)) { - return null; //fatal error + return null; // fatal error } } else if (MatchNodeName(n, XmlTags.AutoSizeNode)) @@ -112,7 +112,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (tableBody.header.columnHeaderDefinitionList.Count != tableBody.defaultDefinition.rowItemDefinitionList.Count) { - //Error at XPath {0} in file {1}: Header item count = {2} does not match default row item count = {3}. + // Error at XPath {0} in file {1}: Header item count = {2} does not match default row item count = {3}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.IncorrectHeaderItemCount, ComputeCurrentXPath(), FilePath, tableBody.header.columnHeaderDefinitionList.Count, tableBody.defaultDefinition.rowItemDefinitionList.Count)); @@ -130,7 +130,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (trd.rowItemDefinitionList.Count != tableBody.defaultDefinition.rowItemDefinitionList.Count) { - //Error at XPath {0} in file {1}: Row item count = {2} on alternative set #{3} does not match default row item count = {4}. + // Error at XPath {0} in file {1}: Row item count = {2} on alternative set #{3} does not match default row item count = {4}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.IncorrectRowItemCount, ComputeCurrentXPath(), FilePath, trd.rowItemDefinitionList.Count, tableBody.defaultDefinition.rowItemDefinitionList.Count, k + 1)); @@ -161,7 +161,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format tableBody.header.columnHeaderDefinitionList.Add(chd); else { - //Error at XPath {0} in file {1}: Column header definition is invalid; all headers are discarded. + // Error at XPath {0} in file {1}: Column header definition is invalid; all headers are discarded. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidColumnHeader, ComputeCurrentXPath(), FilePath)); tableBody.header.columnHeaderDefinitionList = null; return; // fatal error @@ -219,9 +219,9 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - //Error at XPath {0} in file {1}: Invalid {2} value. + // Error at XPath {0} in file {1}: Invalid {2} value. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidNodeValue, ComputeCurrentXPath(), FilePath, XmlTags.WidthNode)); - return null; //fatal error + return null; // fatal error } } else if (MatchNodeName(n, XmlTags.AlignmentNode)) @@ -257,7 +257,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format bool isInteger = int.TryParse(text, out val); if (!isInteger || val <= 0) { - //Error at XPath {0} in file {1}: A positive integer is expected. + // Error at XPath {0} in file {1}: A positive integer is expected. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ExpectPositiveInteger, ComputeCurrentXPath(), FilePath)); return false; } @@ -288,7 +288,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - //Error at XPath {0} in file {1}: "{2}" is not an valid alignment value. + // Error at XPath {0} in file {1}: "{2}" is not an valid alignment value. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidAlignmentValue, ComputeCurrentXPath(), FilePath, alignmentString)); return false; // fatal error } @@ -308,7 +308,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format TableRowDefinition trd = LoadRowEntryDefinition(n, rowEntryIndex++); if (trd == null) { - //Error at XPath {0} in file {1}: {2} failed to load. + // Error at XPath {0} in file {1}: {2} failed to load. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.LoadTagFailed, ComputeCurrentXPath(), FilePath, XmlTags.TableRowEntryNode)); tableBody.defaultDefinition = null; return; // fatal error @@ -323,7 +323,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - //Error at XPath {0} in file {1}: There cannot be more than one default {2}. + // Error at XPath {0} in file {1}: There cannot be more than one default {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.TooManyDefaultShapeEntry, ComputeCurrentXPath(), FilePath, XmlTags.TableRowEntryNode)); tableBody.defaultDefinition = null; return; // fatal error @@ -342,7 +342,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (tableBody.defaultDefinition == null) { - //Error at XPath {0} in file {1}: There must be at least one default {2}. + // Error at XPath {0} in file {1}: There must be at least one default {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoDefaultShapeEntry, ComputeCurrentXPath(), FilePath, XmlTags.TableRowEntryNode)); } } @@ -377,7 +377,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (columnEntriesNodeFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } LoadColumnEntries(n, trd); @@ -391,13 +391,13 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (multiLineFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } multiLineFound = true; if (!this.ReadBooleanNode(n, out trd.multiLine)) { - return null; //fatal error + return null; // fatal error } } else diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Views.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Views.cs index 8d3ea48214..c91b042bf8 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Views.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Views.cs @@ -54,7 +54,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (!success) { - //Error at XPath {0} in file {1}: View cannot be loaded. + // Error at XPath {0} in file {1}: View cannot be loaded. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ViewNotLoaded, ComputeCurrentXPath(), FilePath)); return null; // fatal error } @@ -141,7 +141,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (view.outOfBand && (view.groupBy != null)) { // we cannot have grouping and out of band at the same time - //Error at XPath {0} in file {1}: An Out Of Band view cannot have GroupBy. + // Error at XPath {0} in file {1}: An Out Of Band view cannot have GroupBy. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.OutOfBandGroupByConflict, ComputeCurrentXPath(), FilePath)); return null; // fatal } @@ -173,7 +173,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (!(view.mainControl is ComplexControlBody) && !(view.mainControl is ListControlBody)) { - //Error at XPath {0} in file {1}: Out Of Band views can only have CustomControl or ListControl. + // Error at XPath {0} in file {1}: Out Of Band views can only have CustomControl or ListControl. ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidControlForOutOfBandView, ComputeCurrentXPath(), FilePath)); return false; } @@ -332,9 +332,9 @@ namespace Microsoft.PowerShell.Commands.Internal.Format def.name = GetMandatoryInnerText(n); if (def.name == null) { - //Error at XPath {0} in file {1}: Control cannot have a null Name. + // Error at XPath {0} in file {1}: Control cannot have a null Name. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NullControlName, ComputeCurrentXPath(), FilePath)); - return null; //fatal error + return null; // fatal error } } else if (MatchNodeName(n, XmlTags.ComplexControlNode)) @@ -343,14 +343,14 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (controlNodeFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } controlNodeFound = true; def.controlBody = LoadComplexControl(n); if (def.controlBody == null) { - return null; //fatal error + return null; // fatal error } } else @@ -362,13 +362,13 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (def.name == null) { this.ReportMissingNode(XmlTags.NameNode); - return null; //fatal + return null; // fatal } if (def.controlBody == null) { this.ReportMissingNode(XmlTags.ComplexControlNode); - return null; //fatal + return null; // fatal } return def; diff --git a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Wide.cs b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Wide.cs index d8042cb1f0..749309ee30 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Wide.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader_Wide.cs @@ -112,7 +112,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format WideControlEntryDefinition wved = LoadWideControlEntry(n, entryIndex++); if (wved == null) { - //Error at XPath {0} in file {1}: Invalid {2}. + // Error at XPath {0} in file {1}: Invalid {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidNode, ComputeCurrentXPath(), FilePath, XmlTags.WideEntryNode)); return; } @@ -125,7 +125,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else { - //Error at XPath {0} in file {1}: There cannot be more than one default {2}. + // Error at XPath {0} in file {1}: There cannot be more than one default {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.TooManyDefaultShapeEntry, ComputeCurrentXPath(), FilePath, XmlTags.WideEntryNode)); wideBody.defaultEntryDefinition = null; return; // fatal error @@ -144,7 +144,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (wideBody.defaultEntryDefinition == null) { - //Error at XPath {0} in file {1}: There must be at least one default {2}. + // Error at XPath {0} in file {1}: There must be at least one default {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoDefaultShapeEntry, ComputeCurrentXPath(), FilePath, XmlTags.WideEntryNode)); } } @@ -166,7 +166,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (appliesToNodeFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } appliesToNodeFound = true; @@ -177,16 +177,16 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (propertyEntryNodeFound) { this.ProcessDuplicateNode(n); - return null; //fatal + return null; // fatal } propertyEntryNodeFound = true; wved.formatTokenList = LoadPropertyEntry(n); if (wved.formatTokenList == null) { - //Error at XPath {0} in file {1}: Invalid {2}. + // Error at XPath {0} in file {1}: Invalid {2}. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidNode, ComputeCurrentXPath(), FilePath, XmlTags.WideItemNode)); - return null; //fatal + return null; // fatal } } else @@ -197,9 +197,9 @@ namespace Microsoft.PowerShell.Commands.Internal.Format if (wved.formatTokenList.Count == 0) { - //Error at XPath {0} in file {1}: Missing WideItem. + // Error at XPath {0} in file {1}: Missing WideItem. this.ReportMissingNode(XmlTags.WideItemNode); - return null; //fatal error + return null; // fatal error } return wved; diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatMsgCtxManager.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatMsgCtxManager.cs index 619682f372..3423973d2c 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatMsgCtxManager.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatMsgCtxManager.cs @@ -95,7 +95,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } else if (formatDataIsGroupStartData) { - //GroupStartData gsd = (GroupStartData) formatData; + // GroupStartData gsd = (GroupStartData) formatData; // notify for Gs this.gs(oc); } diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs index 3ea37b87eb..ec261cc305 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Table.cs @@ -47,7 +47,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } // we did not get any properties: - //try to get properties from the default property set of the object + // try to get properties from the default property set of the object this.activeAssociationList = AssociationManager.ExpandDefaultPropertySet(so, this.expressionFactory); if (this.activeAssociationList.Count > 0) { diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Wide.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Wide.cs index 6d7882df45..213ccb4fed 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Wide.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatViewGenerator_Wide.cs @@ -81,7 +81,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format WideViewEntry wve = new WideViewEntry(); wve.formatPropertyField = GenerateFormatPropertyField(activeWideControlEntryDefinition.formatTokenList, so, enumerationLimit); - //wve.alignment = activeWideViewEntryDefinition.alignment; + // wve.alignment = activeWideViewEntryDefinition.alignment; return wve; } @@ -172,7 +172,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } // we did not get any properties: - //try to get the display property of the object + // try to get the display property of the object PSPropertyExpression displayNameExpression = PSObjectHelper.GetDisplayNameExpression(so, this.expressionFactory); if (displayNameExpression != null) { diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs index 5b17aabafa..013d2160fc 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs @@ -333,7 +333,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format StringBuilder unKnowViewFormatStringBuilder = new StringBuilder(); if (validViewFormats.Length > 0) { - //unKnowViewFormatStringBuilder.Append(StringUtil.Format(FormatAndOut_format_xxx.UnknownViewNameError, viewName)); + // unKnowViewFormatStringBuilder.Append(StringUtil.Format(FormatAndOut_format_xxx.UnknownViewNameError, viewName)); unKnowViewFormatStringBuilder.Append(StringUtil.Format(FormatAndOut_format_xxx.UnknownViewNameErrorSuffix, viewName, formatTypeName)); unKnowViewFormatStringBuilder.Append(validViewFormats.ToString()); } diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormattingObjectsDeserializer.cs b/src/System.Management.Automation/FormatAndOutput/common/FormattingObjectsDeserializer.cs index 1aa29cec20..cf168d9794 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormattingObjectsDeserializer.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormattingObjectsDeserializer.cs @@ -523,7 +523,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer) { base.Deserialize(so, deserializer); - //optional + // optional this.groupingEntry = (GroupingEntry)deserializer.DeserializeMemberObject(so, "groupingEntry"); } } diff --git a/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshParameterAssociation.cs b/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshParameterAssociation.cs index ee21791f83..1e65a3adbf 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshParameterAssociation.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/Utilities/MshParameterAssociation.cs @@ -46,7 +46,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } // we did not get any properties: - //try to get properties from the default property set of the object + // try to get properties from the default property set of the object List activeAssociationList = AssociationManager.ExpandDefaultPropertySet(target, expressionFactory); if (activeAssociationList.Count > 0) diff --git a/src/System.Management.Automation/FormatAndOutput/out-console/ConsoleLineOutput.cs b/src/System.Management.Automation/FormatAndOutput/out-console/ConsoleLineOutput.cs index e9f5cd8db7..2f668fb32e 100644 --- a/src/System.Management.Automation/FormatAndOutput/out-console/ConsoleLineOutput.cs +++ b/src/System.Management.Automation/FormatAndOutput/out-console/ConsoleLineOutput.cs @@ -95,8 +95,8 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } catch (HostException) { - //thrown when external host rawui is not implemented, in which case - //we will fallback to the default value. + // thrown when external host rawui is not implemented, in which case + // we will fallback to the default value. } return string.IsNullOrEmpty(str) ? 0 : str.Length - offset; @@ -110,8 +110,8 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } catch (HostException) { - //thrown when external host rawui is not implemented, in which case - //we will fallback to the default value. + // thrown when external host rawui is not implemented, in which case + // we will fallback to the default value. } return string.IsNullOrEmpty(str) ? 0 : str.Length; @@ -125,8 +125,8 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } catch (HostException) { - //thrown when external host rawui is not implemented, in which case - //we will fallback to the default value. + // thrown when external host rawui is not implemented, in which case + // we will fallback to the default value. } return 1; @@ -180,8 +180,8 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } catch (HostException) { - //thrown when external host rawui is not implemented, in which case - //we will fallback to the default value. + // thrown when external host rawui is not implemented, in which case + // we will fallback to the default value. } return _forceNewLine ? _fallbackRawConsoleColumnNumber - 1 : _fallbackRawConsoleColumnNumber; @@ -206,8 +206,8 @@ namespace Microsoft.PowerShell.Commands.Internal.Format } catch (HostException) { - //thrown when external host rawui is not implemented, in which case - //we will fallback to the default value. + // thrown when external host rawui is not implemented, in which case + // we will fallback to the default value. } return _fallbackRawConsoleRowNumber; diff --git a/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs b/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs index 10e675e938..0b9225dd5e 100644 --- a/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs +++ b/src/System.Management.Automation/cimSupport/cmdletization/ScriptWriter.cs @@ -47,7 +47,7 @@ namespace Microsoft.PowerShell.Cmdletization ScriptWriter.s_xmlReaderSettings.MaxCharactersInDocument = 128 * 1024 * 1024; // generous guess for the upper bound #if CORECLR // The XML Schema file 'cmdlets-over-objects.xsd' is missing in Github, and it's likely the resource string - //'CmdletizationCoreResources.Xml_cmdletsOverObjectsXsd' needs to be reworked to work in .NET Core. + // 'CmdletizationCoreResources.Xml_cmdletsOverObjectsXsd' needs to be reworked to work in .NET Core. ScriptWriter.s_xmlReaderSettings.DtdProcessing = DtdProcessing.Ignore; #else ScriptWriter.s_xmlReaderSettings.DtdProcessing = DtdProcessing.Parse; // Allowing DTD parsing with limits of MaxCharactersFromEntities/MaxCharactersInDocument @@ -929,12 +929,12 @@ function __cmdletization_BindCommonParameters } } - private const string StaticCommonParameterSetTemplate = "{1}"; //"{0}::{1}"; - private const string StaticMethodParameterSetTemplate = "{0}"; //"{1}::{0}"; + private const string StaticCommonParameterSetTemplate = "{1}"; // "{0}::{1}"; + private const string StaticMethodParameterSetTemplate = "{0}"; // "{1}::{0}"; - private const string InstanceCommonParameterSetTemplate = "{1}"; //"{0}::{1}::{2}"; - private const string InstanceQueryParameterSetTemplate = "{0}"; //"{1}::{0}::{2}"; - private const string InstanceMethodParameterSetTemplate = "{2}"; //"{1}::{2}::{0}"; + private const string InstanceCommonParameterSetTemplate = "{1}"; // "{0}::{1}::{2}"; + private const string InstanceQueryParameterSetTemplate = "{0}"; // "{1}::{0}::{2}"; + private const string InstanceMethodParameterSetTemplate = "{2}"; // "{1}::{2}::{0}"; private const string InputObjectQueryParameterSetName = "InputObject (cdxml)"; private const string SingleQueryParameterSetName = "Query (cdxml)"; diff --git a/src/System.Management.Automation/cimSupport/other/ciminstancetypeadapter.cs b/src/System.Management.Automation/cimSupport/other/ciminstancetypeadapter.cs index a6cdb880f6..bc41b2d56c 100644 --- a/src/System.Management.Automation/cimSupport/other/ciminstancetypeadapter.cs +++ b/src/System.Management.Automation/cimSupport/other/ciminstancetypeadapter.cs @@ -28,7 +28,7 @@ namespace Microsoft.PowerShell.Cim { PSAdaptedProperty propertyToAdd = new PSAdaptedProperty(propertyName, property); propertyToAdd.baseObject = baseObject; - //propertyToAdd.adapter = this; + // propertyToAdd.adapter = this; return propertyToAdd; } @@ -50,7 +50,7 @@ namespace Microsoft.PowerShell.Cim { PSAdaptedProperty psComputerNameProperty = new PSAdaptedProperty(RemotingConstants.ComputerNameNoteProperty, cimInstance); psComputerNameProperty.baseObject = cimInstance; - //psComputerNameProperty.adapter = this; + // psComputerNameProperty.adapter = this; return psComputerNameProperty; } diff --git a/src/System.Management.Automation/engine/ArgumentTypeConverterAttribute.cs b/src/System.Management.Automation/engine/ArgumentTypeConverterAttribute.cs index dda30c4b72..22a734d9d3 100644 --- a/src/System.Management.Automation/engine/ArgumentTypeConverterAttribute.cs +++ b/src/System.Management.Automation/engine/ArgumentTypeConverterAttribute.cs @@ -105,11 +105,11 @@ namespace System.Management.Automation } } - //BUGBUG - //NTRAID#Windows Out of Band Releases - 930116 - 03/14/06 - //handling special case for boolean, switchparameter and Nullable - //These parameter types will not be converted if the incoming value types are not - //one of the accepted categories - $true/$false or numbers (0 or otherwise) + // BUGBUG + // NTRAID#Windows Out of Band Releases - 930116 - 03/14/06 + // handling special case for boolean, switchparameter and Nullable + // These parameter types will not be converted if the incoming value types are not + // one of the accepted categories - $true/$false or numbers (0 or otherwise) if (LanguagePrimitives.IsBoolOrSwitchParameterType(_convertTypes[i])) { CheckBoolValue(result, _convertTypes[i]); diff --git a/src/System.Management.Automation/engine/Attributes.cs b/src/System.Management.Automation/engine/Attributes.cs index 629475c628..9a28cbc836 100644 --- a/src/System.Management.Automation/engine/Attributes.cs +++ b/src/System.Management.Automation/engine/Attributes.cs @@ -429,7 +429,7 @@ namespace System.Management.Automation /// For invalid arguments. public CmdletAttribute(string verbName, string nounName) { - //NounName,VerbName have to be Non-Null strings + // NounName,VerbName have to be Non-Null strings if (string.IsNullOrEmpty(nounName)) { throw PSTraceSource.NewArgumentException("nounName"); diff --git a/src/System.Management.Automation/engine/COM/ComMethod.cs b/src/System.Management.Automation/engine/COM/ComMethod.cs index 0fc527fa1d..4e3fc31952 100644 --- a/src/System.Management.Automation/engine/COM/ComMethod.cs +++ b/src/System.Management.Automation/engine/COM/ComMethod.cs @@ -104,7 +104,7 @@ namespace System.Management.Automation } catch (TargetInvocationException te) { - //First check if this is a severe exception. + // First check if this is a severe exception. var innerCom = te.InnerException as COMException; if (innerCom == null || innerCom.HResult != ComUtil.DISP_E_MEMBERNOTFOUND) { diff --git a/src/System.Management.Automation/engine/COM/ComTypeInfo.cs b/src/System.Management.Automation/engine/COM/ComTypeInfo.cs index dd0fa0a0b2..4635a44b4d 100644 --- a/src/System.Management.Automation/engine/COM/ComTypeInfo.cs +++ b/src/System.Management.Automation/engine/COM/ComTypeInfo.cs @@ -98,7 +98,7 @@ namespace System.Management.Automation { COM.TYPEATTR typeattr = GetTypeAttr(_typeinfo); - //Initialize the type information guid + // Initialize the type information guid _guid = typeattr.guid; for (int i = 0; i < typeattr.cFuncs; i++) @@ -156,13 +156,13 @@ namespace System.Management.Automation if ((typeattr.typekind == COM.TYPEKIND.TKIND_INTERFACE)) { - //We have typeinfo for custom interface. Get typeinfo for Dispatch interface. + // We have typeinfo for custom interface. Get typeinfo for Dispatch interface. typeinfo = GetDispatchTypeInfoFromCustomInterfaceTypeInfo(typeinfo); } if ((typeattr.typekind == COM.TYPEKIND.TKIND_COCLASS)) { - //We have typeinfo for the COClass. Find the default interface and get typeinfo for default interface. + // We have typeinfo for the COClass. Find the default interface and get typeinfo for default interface. typeinfo = GetDispatchTypeInfoFromCoClassTypeInfo(typeinfo); } @@ -250,11 +250,11 @@ namespace System.Management.Automation } catch (COMException ce) { - //check if the error code is TYPE_E_ELEMENTNOTFOUND. - //This error code is thrown when we can't IDispatch interface. + // check if the error code is TYPE_E_ELEMENTNOTFOUND. + // This error code is thrown when we can't IDispatch interface. if (ce.HResult != ComUtil.TYPE_E_ELEMENTNOTFOUND) { - //For other codes, rethrow the exception. + // For other codes, rethrow the exception. throw; } } @@ -269,16 +269,16 @@ namespace System.Management.Automation /// ITypeInfo reference to the Dispatch interface. internal static COM.ITypeInfo GetDispatchTypeInfoFromCoClassTypeInfo(COM.ITypeInfo typeinfo) { - //Get the number of interfaces implemented by this CoClass. + // Get the number of interfaces implemented by this CoClass. COM.TYPEATTR typeattr = GetTypeAttr(typeinfo); int count = typeattr.cImplTypes; int href; COM.ITypeInfo interfaceinfo = null; - //For each interface implemented by this coclass + // For each interface implemented by this coclass for (int i = 0; i < count; i++) { - //Get the type information? + // Get the type information? typeinfo.GetRefTypeOfImplType(i, out href); typeinfo.GetRefTypeInfo(href, out interfaceinfo); typeattr = GetTypeAttr(interfaceinfo); @@ -289,7 +289,7 @@ namespace System.Management.Automation return interfaceinfo; } - //Nope. Is this a dual interface + // Nope. Is this a dual interface if ((typeattr.wTypeFlags & COM.TYPEFLAGS.TYPEFLAG_FDUAL) != 0) { interfaceinfo = GetDispatchTypeInfoFromCustomInterfaceTypeInfo(interfaceinfo); diff --git a/src/System.Management.Automation/engine/COM/ComUtil.cs b/src/System.Management.Automation/engine/COM/ComUtil.cs index 59ff8542f2..3114a7937c 100644 --- a/src/System.Management.Automation/engine/COM/ComUtil.cs +++ b/src/System.Management.Automation/engine/COM/ComUtil.cs @@ -39,12 +39,12 @@ namespace System.Management.Automation if (!isPropertyPut) { - //First get the string for return type. + // First get the string for return type. string retstring = GetStringFromTypeDesc(typeinfo, funcdesc.elemdescFunc.tdesc); builder.Append(retstring + " "); } - //Append the function name + // Append the function name builder.Append(name); builder.Append(" ("); @@ -60,8 +60,8 @@ namespace System.Management.Automation ElementDescription = new COM.ELEMDESC(); ElementDescriptionArrayByteOffset = i * ElementDescriptionSize; - //Disable PRefast warning for converting to int32 and converting back into intptr. - //Code below takes into account 32 bit vs 64 bit conversions + // Disable PRefast warning for converting to int32 and converting back into intptr. + // Code below takes into account 32 bit vs 64 bit conversions #pragma warning disable 56515 if (IntPtr.Size == 4) { @@ -105,7 +105,7 @@ namespace System.Management.Automation /// Name of the method or property. internal static string GetNameFromFuncDesc(COM.ITypeInfo typeinfo, COM.FUNCDESC funcdesc) { - //Get the method or property name. + // Get the method or property name. string strName, strDoc, strHelp; int id; typeinfo.GetDocumentation(funcdesc.memid, out strName, out strDoc, out id, out strHelp); @@ -302,8 +302,8 @@ namespace System.Management.Automation ElementDescription = new COM.ELEMDESC(); ElementDescriptionArrayByteOffset = i * ElementDescriptionSize; - //Disable PRefast warning for converting to int32 and converting back into intptr. - //Code below takes into account 32 bit vs 64 bit conversions + // Disable PRefast warning for converting to int32 and converting back into intptr. + // Code below takes into account 32 bit vs 64 bit conversions #pragma warning disable 56515 if (IntPtr.Size == 4) @@ -319,11 +319,11 @@ namespace System.Management.Automation ElementDescription = Marshal.PtrToStructure(ElementDescriptionPointer); - //get the type of parameter + // get the type of parameter Type type = ComUtil.GetTypeFromTypeDesc(ElementDescription.tdesc); object defaultvalue = null; - //check is this parameter is optional. + // check is this parameter is optional. if ((ElementDescription.desc.paramdesc.wParamFlags & COM.PARAMFLAG.PARAMFLAG_FOPT) != 0) { fOptional = true; diff --git a/src/System.Management.Automation/engine/ComInterop/BoolArgBuilder.cs b/src/System.Management.Automation/engine/ComInterop/BoolArgBuilder.cs index eebd876905..cdc2a45287 100644 --- a/src/System.Management.Automation/engine/ComInterop/BoolArgBuilder.cs +++ b/src/System.Management.Automation/engine/ComInterop/BoolArgBuilder.cs @@ -31,7 +31,7 @@ namespace System.Management.Automation.ComInterop internal override Expression UnmarshalFromRef(Expression value) { - //parameter = temp != 0 + // parameter = temp != 0 return base.UnmarshalFromRef( Expression.NotEqual( value, diff --git a/src/System.Management.Automation/engine/ComInterop/ComBinderHelpers.cs b/src/System.Management.Automation/engine/ComInterop/ComBinderHelpers.cs index af35c44a24..81bf472159 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComBinderHelpers.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComBinderHelpers.cs @@ -130,7 +130,7 @@ namespace System.Management.Automation.ComInterop { if (obj.Value == null && obj.HasValue) { - //If the meta object holds a null value, create an instance restriction for checking null + // If the meta object holds a null value, create an instance restriction for checking null return BindingRestrictions.GetInstanceRestriction(obj.Expression, null); } diff --git a/src/System.Management.Automation/engine/ComInterop/ComEventSink.cs b/src/System.Management.Automation/engine/ComInterop/ComEventSink.cs index 472e460739..110180405e 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComEventSink.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComEventSink.cs @@ -184,7 +184,7 @@ namespace System.Management.Automation.ComInterop // We can Unadvise from the ConnectionPoint if no more sink entries // are registered for this interface - //(calling Dispose will call IConnectionPoint.Unadvise). + // (calling Dispose will call IConnectionPoint.Unadvise). if (_comEventSinkMethods.Count == 0) { // notice that we do not remove diff --git a/src/System.Management.Automation/engine/ComInterop/ComEventSinkProxy.cs b/src/System.Management.Automation/engine/ComInterop/ComEventSinkProxy.cs index d5c4ea01ba..be368a74ef 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComEventSinkProxy.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComEventSinkProxy.cs @@ -73,7 +73,7 @@ namespace System.Management.Automation.ComInterop [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] public override IMessage Invoke(IMessage msg) { - //Only know how to handle method calls (property and fields accessors count as methods) + // Only know how to handle method calls (property and fields accessors count as methods) IMethodCallMessage methodCallMessage = msg as IMethodCallMessage; if (methodCallMessage == null) throw new NotSupportedException(); diff --git a/src/System.Management.Automation/engine/ComInterop/ComMethodDesc.cs b/src/System.Management.Automation/engine/ComInterop/ComMethodDesc.cs index 69bef17875..44bdaa9131 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComMethodDesc.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComMethodDesc.cs @@ -80,13 +80,13 @@ namespace System.Management.Automation.ComInterop { get { - //must be regular get + // must be regular get if (!IsPropertyGet || DispId == ComDispIds.DISPID_NEWENUM) { return false; } - //must have no parameters + // must have no parameters return ParamCount == 0; } } diff --git a/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs b/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs index 06f04176bc..c0c6e0b113 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComParamDesc.cs @@ -40,7 +40,7 @@ namespace System.Management.Automation.ComInterop IsOut = (elemDesc.desc.paramdesc.wParamFlags & PARAMFLAG.PARAMFLAG_FOUT) != 0; IsOptional = (elemDesc.desc.paramdesc.wParamFlags & PARAMFLAG.PARAMFLAG_FOPT) != 0; // TODO: The PARAMDESCEX struct has a memory issue that needs to be resolved. For now, we ignore it. - //_defaultValue = PARAMDESCEX.GetDefaultValue(ref elemDesc.desc.paramdesc); + // _defaultValue = PARAMDESCEX.GetDefaultValue(ref elemDesc.desc.paramdesc); } _name = name; diff --git a/src/System.Management.Automation/engine/ComInterop/ComRuntimeHelpers.cs b/src/System.Management.Automation/engine/ComInterop/ComRuntimeHelpers.cs index 430f000acf..85f0439e9a 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComRuntimeHelpers.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComRuntimeHelpers.cs @@ -38,7 +38,7 @@ namespace System.Management.Automation.ComInterop break; case ComHresults.DISP_E_BADVARTYPE: - //One of the arguments in rgvarg is not a valid variant type. + // One of the arguments in rgvarg is not a valid variant type. break; case ComHresults.DISP_E_EXCEPTION: @@ -642,7 +642,7 @@ namespace System.Management.Automation.ComInterop { var attributes = new[] { new CustomAttributeBuilder(typeof(UnverifiableCodeAttribute).GetConstructor(Type.EmptyTypes), Utils.EmptyArray()), - //PermissionSet(SecurityAction.Demand, Unrestricted = true) + // PermissionSet(SecurityAction.Demand, Unrestricted = true) new CustomAttributeBuilder(typeof(PermissionSetAttribute).GetConstructor(new Type[] { typeof(SecurityAction) }), new object[] { SecurityAction.Demand }, new PropertyInfo[] { typeof(PermissionSetAttribute).GetProperty("Unrestricted") }, diff --git a/src/System.Management.Automation/engine/ComInterop/ComTypeDesc.cs b/src/System.Management.Automation/engine/ComInterop/ComTypeDesc.cs index 4ccff52b85..474efd7588 100644 --- a/src/System.Management.Automation/engine/ComInterop/ComTypeDesc.cs +++ b/src/System.Management.Automation/engine/ComInterop/ComTypeDesc.cs @@ -15,8 +15,8 @@ namespace System.Management.Automation.ComInterop { private string _typeName; private string _documentation; - //Hashtable is threadsafe for multiple readers single writer. - //Enumerating and writing is mutually exclusive so require locking. + // Hashtable is threadsafe for multiple readers single writer. + // Enumerating and writing is mutually exclusive so require locking. private Hashtable _putRefs; private ComMethodDesc _getItem; private ComMethodDesc _setItem; diff --git a/src/System.Management.Automation/engine/ComInterop/ConversionArgBuilder.cs b/src/System.Management.Automation/engine/ComInterop/ConversionArgBuilder.cs index ebb79e4b82..a9dc572b1b 100644 --- a/src/System.Management.Automation/engine/ComInterop/ConversionArgBuilder.cs +++ b/src/System.Management.Automation/engine/ComInterop/ConversionArgBuilder.cs @@ -30,7 +30,7 @@ namespace System.Management.Automation.ComInterop internal override Expression MarshalToRef(Expression parameter) { - //we are not supporting conversion InOut + // we are not supporting conversion InOut throw Assert.Unreachable; } } diff --git a/src/System.Management.Automation/engine/ComInterop/ConvertibleArgBuilder.cs b/src/System.Management.Automation/engine/ComInterop/ConvertibleArgBuilder.cs index 29cf290256..66f60c9475 100644 --- a/src/System.Management.Automation/engine/ComInterop/ConvertibleArgBuilder.cs +++ b/src/System.Management.Automation/engine/ComInterop/ConvertibleArgBuilder.cs @@ -26,7 +26,7 @@ namespace System.Management.Automation.ComInterop internal override Expression MarshalToRef(Expression parameter) { - //we are not supporting convertible InOut + // we are not supporting convertible InOut throw Assert.Unreachable; } } diff --git a/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs b/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs index c5468343f9..e739cad344 100644 --- a/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs +++ b/src/System.Management.Automation/engine/ComInterop/IDispatchComObject.cs @@ -338,7 +338,7 @@ namespace System.Management.Automation.ComInterop ); members.Add(new KeyValuePair(method.Name, value)); - //evaluation failed for some reason. pass exception out + // evaluation failed for some reason. pass exception out } catch (Exception ex) { @@ -589,14 +589,14 @@ namespace System.Management.Automation.ComInterop if (typeAttr.typekind == ComTypes.TYPEKIND.TKIND_INTERFACE) { - //We have typeinfo for custom interface. Get typeinfo for Dispatch interface. + // We have typeinfo for custom interface. Get typeinfo for Dispatch interface. typeInfo = ComTypeInfo.GetDispatchTypeInfoFromCustomInterfaceTypeInfo(typeInfo); typeAttr = ComRuntimeHelpers.GetTypeAttrForTypeInfo(typeInfo); } if (typeAttr.typekind == ComTypes.TYPEKIND.TKIND_COCLASS) { - //We have typeinfo for the COClass. Find the default interface and get typeinfo for default interface. + // We have typeinfo for the COClass. Find the default interface and get typeinfo for default interface. typeInfo = ComTypeInfo.GetDispatchTypeInfoFromCoClassTypeInfo(typeInfo); typeAttr = ComRuntimeHelpers.GetTypeAttrForTypeInfo(typeInfo); } diff --git a/src/System.Management.Automation/engine/ComInterop/TypeUtils.cs b/src/System.Management.Automation/engine/ComInterop/TypeUtils.cs index 078da6759b..0b406c56cd 100644 --- a/src/System.Management.Automation/engine/ComInterop/TypeUtils.cs +++ b/src/System.Management.Automation/engine/ComInterop/TypeUtils.cs @@ -14,7 +14,7 @@ namespace System.Management.Automation.ComInterop private const BindingFlags AnyStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; internal const MethodAttributes PublicStatic = MethodAttributes.Public | MethodAttributes.Static; - //CONFORMING + // CONFORMING internal static Type GetNonNullableType(Type type) { if (IsNullableType(type)) @@ -25,13 +25,13 @@ namespace System.Management.Automation.ComInterop return type; } - //CONFORMING + // CONFORMING internal static bool IsNullableType(this Type type) { return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>); } - //CONFORMING + // CONFORMING internal static bool AreReferenceAssignable(Type dest, Type src) { // WARNING: This actually implements "Is this identity assignable and/or reference assignable?" @@ -47,7 +47,7 @@ namespace System.Management.Automation.ComInterop return false; } - //CONFORMING + // CONFORMING internal static bool AreAssignable(Type dest, Type src) { if (dest == src) @@ -77,7 +77,7 @@ namespace System.Management.Automation.ComInterop return false; } - //CONFORMING + // CONFORMING internal static bool IsImplicitlyConvertible(Type source, Type destination) { return IsIdentityConversion(source, destination) || @@ -92,7 +92,7 @@ namespace System.Management.Automation.ComInterop (considerUserDefined && GetUserDefinedCoercionMethod(source, destination, true) != null); } - //CONFORMING + // CONFORMING internal static MethodInfo GetUserDefinedCoercionMethod(Type convertFrom, Type convertToType, bool implicitOnly) { // check for implicit coercions first @@ -126,7 +126,7 @@ namespace System.Management.Automation.ComInterop return null; } - //CONFORMING + // CONFORMING internal static MethodInfo FindConversionOperator(MethodInfo[] methods, Type typeFrom, Type typeTo, bool implicitOnly) { foreach (MethodInfo mi in methods) @@ -144,13 +144,13 @@ namespace System.Management.Automation.ComInterop return null; } - //CONFORMING + // CONFORMING private static bool IsIdentityConversion(Type source, Type destination) { return source == destination; } - //CONFORMING + // CONFORMING [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] private static bool IsImplicitNumericConversion(Type source, Type destination) { @@ -270,13 +270,13 @@ namespace System.Management.Automation.ComInterop return false; } - //CONFORMING + // CONFORMING private static bool IsImplicitReferenceConversion(Type source, Type destination) { return AreAssignable(destination, source); } - //CONFORMING + // CONFORMING private static bool IsImplicitBoxingConversion(Type source, Type destination) { if (source.IsValueType && (destination == typeof(object) || destination == typeof(System.ValueType))) diff --git a/src/System.Management.Automation/engine/ComInterop/VarEnumSelector.cs b/src/System.Management.Automation/engine/ComInterop/VarEnumSelector.cs index 25449a5eed..2449224892 100644 --- a/src/System.Management.Automation/engine/ComInterop/VarEnumSelector.cs +++ b/src/System.Management.Automation/engine/ComInterop/VarEnumSelector.cs @@ -374,13 +374,13 @@ namespace System.Management.Automation.ComInterop { if (argumentType == typeof(Missing)) { - //actual variant type will be VT_ERROR | E_PARAMNOTFOUND + // actual variant type will be VT_ERROR | E_PARAMNOTFOUND return VarEnum.VT_RECORD; } if (argumentType.IsArray) { - //actual variant type will be VT_ARRAY | VT_ + // actual variant type will be VT_ARRAY | VT_ return VarEnum.VT_ARRAY; } @@ -426,7 +426,7 @@ namespace System.Management.Automation.ComInterop return GetComType(ref argumentType); } - //generic types cannot be exposed to COM so they do not implement COM interfaces. + // generic types cannot be exposed to COM so they do not implement COM interfaces. if (argumentType.IsGenericType) { return VarEnum.VT_UNKNOWN; @@ -447,8 +447,8 @@ namespace System.Management.Automation.ComInterop /// private VariantBuilder GetVariantBuilder(Type argumentType) { - //argumentType is coming from MarshalType, null means the dynamic object holds - //a null value and not byref + // argumentType is coming from MarshalType, null means the dynamic object holds + // a null value and not byref if (argumentType == null) { return new VariantBuilder(VarEnum.VT_EMPTY, new NullArgBuilder()); @@ -468,9 +468,9 @@ namespace System.Management.Automation.ComInterop VarEnum elementVarEnum; if (elementType == typeof(object) || elementType == typeof(DBNull)) { - //no meaningful value to pass ByRef. - //perhaps the calee will replace it with something. - //need to pass as a variant reference + // no meaningful value to pass ByRef. + // perhaps the calee will replace it with something. + // need to pass as a variant reference elementVarEnum = VarEnum.VT_VARIANT; } else @@ -496,7 +496,7 @@ namespace System.Management.Automation.ComInterop // if VT indicates that marshalling type is unknown if (elementVarEnum == VT_DEFAULT) { - //trying to find a conversion. + // trying to find a conversion. VarEnum convertibleTo; if (TryGetPrimitiveComTypeViaConversion(elementType, out convertibleTo)) { @@ -505,7 +505,7 @@ namespace System.Management.Automation.ComInterop return new ConversionArgBuilder(elementType, GetSimpleArgBuilder(marshalType, elementVarEnum)); } - //checking for IConvertible. + // checking for IConvertible. if (typeof(IConvertible).IsAssignableFrom(elementType)) { return new ConvertibleArgBuilder(); diff --git a/src/System.Management.Automation/engine/ComInterop/VariantBuilder.cs b/src/System.Management.Automation/engine/ComInterop/VariantBuilder.cs index 9050c4ecb4..216bc443a5 100644 --- a/src/System.Management.Automation/engine/ComInterop/VariantBuilder.cs +++ b/src/System.Management.Automation/engine/ComInterop/VariantBuilder.cs @@ -36,9 +36,9 @@ namespace System.Management.Automation.ComInterop internal Expression InitializeArgumentVariant(MemberExpression variant, Expression parameter) { - //NOTE: we must remember our variant - //the reason is that argument order does not map exactly to the order of variants for invoke - //and when we are doing clean-up we must be sure we are cleaning the variant we have initialized. + // NOTE: we must remember our variant + // the reason is that argument order does not map exactly to the order of variants for invoke + // and when we are doing clean-up we must be sure we are cleaning the variant we have initialized. _variant = variant; diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs index 75df2aaabd..3d888ad9eb 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs @@ -1764,7 +1764,7 @@ namespace System.Management.Automation private List GetResultForAttributeArgument(CompletionContext completionContext, ref int replacementIndex, ref int replacementLength) { - //Attribute member arguments + // Attribute member arguments Type attributeType = null; string argName = string.Empty; Ast argAst = completionContext.RelatedAsts.Find(ast => ast is NamedAttributeArgumentAst); diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs index 53d2717877..6f0715ef44 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs @@ -829,7 +829,7 @@ namespace System.Management.Automation if (expressionAst is ErrorExpressionAst && expressionAst.Extent.Text.EndsWith(",", StringComparison.Ordinal)) { context.WordToComplete = string.Empty; - //BUGBUG context.CursorPosition = expressionAst.Extent.StartScriptPosition; + // BUGBUG context.CursorPosition = expressionAst.Extent.StartScriptPosition; } else if (commandAst.CommandElements.Count == 1 || context.WordToComplete == string.Empty) { @@ -875,7 +875,7 @@ namespace System.Management.Automation context.ReplacementIndex = ((InternalScriptPosition)secondToLastAst.Extent.StartScriptPosition).Offset; context.ReplacementLength += ((InternalScriptPosition)secondToLastAst.Extent.EndScriptPosition).Offset - context.ReplacementIndex; context.WordToComplete = fullPath; - //context.CursorPosition = secondToLastAst.Extent.StartScriptPosition; + // context.CursorPosition = secondToLastAst.Extent.StartScriptPosition; } else if (secondToLastArrayAst != null) { @@ -962,7 +962,7 @@ namespace System.Management.Automation { // dir -Path: a.txt, context.WordToComplete = string.Empty; - //context.CursorPosition = expressionAst.Extent.StartScriptPosition; + // context.CursorPosition = expressionAst.Extent.StartScriptPosition; } else if (context.WordToComplete == string.Empty) { @@ -3643,7 +3643,7 @@ namespace System.Management.Automation var isFileSystem = provider != null && provider.Name.Equals(FileSystemProvider.ProviderName, StringComparison.OrdinalIgnoreCase); - //AutoComplete only if filesystem provider. + // AutoComplete only if filesystem provider. if (isFileSystem) { if (paramName.Equals("ItemType", StringComparison.OrdinalIgnoreCase)) @@ -5969,7 +5969,7 @@ namespace System.Management.Automation } } - //this is a temporary fix. Only the type defined in the same script get complete. Need to use using Module when that is available. + // this is a temporary fix. Only the type defined in the same script get complete. Need to use using Module when that is available. var scriptBlockAst = (ScriptBlockAst)context.RelatedAsts[0]; var typeAsts = scriptBlockAst.FindAll(ast => ast is TypeDefinitionAst, false).Cast(); foreach (var typeAst in typeAsts.Where(ast => pattern.IsMatch(ast.Name))) @@ -6386,7 +6386,7 @@ namespace System.Management.Automation private static List GetSpecialHashTableKeyMembers(params string[] keys) { // Resources were removed because they missed the deadline for loc. - //return keys.Select(key => new CompletionResult(key, key, CompletionResultType.Property, + // return keys.Select(key => new CompletionResult(key, key, CompletionResultType.Property, // ResourceManagerCache.GetResourceString(typeof(CompletionCompleters).Assembly, // "TabCompletionStrings", key + "HashKeyDescription"))).ToList(); return keys.Select(key => new CompletionResult(key, key, CompletionResultType.Property, key)).ToList(); diff --git a/src/System.Management.Automation/engine/CommandCompletion/PseudoParameterBinder.cs b/src/System.Management.Automation/engine/CommandCompletion/PseudoParameterBinder.cs index 3f4aa2b3ac..242708221c 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/PseudoParameterBinder.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/PseudoParameterBinder.cs @@ -1415,7 +1415,7 @@ namespace System.Management.Automation.Language Diagnostics.Assert(argument.ParameterSpecified && !argument.ArgumentSpecified, "At this point, the parameters should have no arguments"); - //Now check the parameter name with the bindable parameters + // Now check the parameter name with the bindable parameters string parameterName = argument.ParameterName; MergedCompiledCommandParameter matchingParameter = null; diff --git a/src/System.Management.Automation/engine/CommandDiscovery.cs b/src/System.Management.Automation/engine/CommandDiscovery.cs index 4b7ad555ee..52b3aa0572 100644 --- a/src/System.Management.Automation/engine/CommandDiscovery.cs +++ b/src/System.Management.Automation/engine/CommandDiscovery.cs @@ -648,7 +648,7 @@ namespace System.Management.Automation internal static void ShouldRun(ExecutionContext context, PSHost host, CommandInfo commandInfo, CommandOrigin commandOrigin) { - //ShouldRunInternal throws PSSecurityException if run is not allowed + // ShouldRunInternal throws PSSecurityException if run is not allowed try { if (commandOrigin == CommandOrigin.Runspace && commandInfo.Visibility != SessionStateEntryVisibility.Public) @@ -962,7 +962,7 @@ namespace System.Management.Automation { exception = e; discoveryTracer.WriteLine("Encountered error importing module: {0}", e.Message); - //Call-out to user code, catch-all OK + // Call-out to user code, catch-all OK } return matchingModules; @@ -1111,7 +1111,7 @@ namespace System.Management.Automation if (exportedCommands == null) { continue; } CommandTypes exportedCommandTypes; - //Skip if module only has class or other types and no commands. + // Skip if module only has class or other types and no commands. if (exportedCommands.TryGetValue(commandName, out exportedCommandTypes)) { Exception exception; diff --git a/src/System.Management.Automation/engine/CommandInfo.cs b/src/System.Management.Automation/engine/CommandInfo.cs index fd3ff66359..49386e1d10 100644 --- a/src/System.Management.Automation/engine/CommandInfo.cs +++ b/src/System.Management.Automation/engine/CommandInfo.cs @@ -151,9 +151,9 @@ namespace System.Management.Automation internal CommandInfo(CommandInfo other) { // Computed fields not copied: - //this._externalCommandMetadata = other._externalCommandMetadata; - //this._moduleName = other._moduleName; - //this.parameterSets = other.parameterSets; + // this._externalCommandMetadata = other._externalCommandMetadata; + // this._moduleName = other._moduleName; + // this.parameterSets = other.parameterSets; this.Module = other.Module; _visibility = other._visibility; Arguments = other.Arguments; diff --git a/src/System.Management.Automation/engine/CoreAdapter.cs b/src/System.Management.Automation/engine/CoreAdapter.cs index ccaaf28c0c..13c2d908e0 100644 --- a/src/System.Management.Automation/engine/CoreAdapter.cs +++ b/src/System.Management.Automation/engine/CoreAdapter.cs @@ -899,7 +899,7 @@ namespace System.Management.Automation } // The methods with fewer parameter wins - //Need to revisit this if we support named arguments + // Need to revisit this if we support named arguments if (betterCount == 0) { if (candidate1.parameters.Length < candidate2.parameters.Length) diff --git a/src/System.Management.Automation/engine/Credential.cs b/src/System.Management.Automation/engine/Credential.cs index 5a5a589765..f42b11b95e 100644 --- a/src/System.Management.Automation/engine/Credential.cs +++ b/src/System.Management.Automation/engine/Credential.cs @@ -335,9 +335,9 @@ namespace System.Management.Automation (domain == null) || (user.Length == 0)) { - //UserName is the public property of Credential object. Use this as - //parameter name in error - //See bug NTRAID#Windows OS Bugs-1106386-2005/03/25-hiteshr + // UserName is the public property of Credential object. Use this as + // parameter name in error + // See bug NTRAID#Windows OS Bugs-1106386-2005/03/25-hiteshr throw PSTraceSource.NewArgumentException("UserName", Credential.InvalidUserNameFormat); } diff --git a/src/System.Management.Automation/engine/EnumExpressionEvaluator.cs b/src/System.Management.Automation/engine/EnumExpressionEvaluator.cs index 0611f775ec..891ddab7c7 100644 --- a/src/System.Management.Automation/engine/EnumExpressionEvaluator.cs +++ b/src/System.Management.Automation/engine/EnumExpressionEvaluator.cs @@ -440,8 +440,8 @@ namespace System.Management.Automation private Token GetNextToken(string input, ref int _offset) { StringBuilder sb = new StringBuilder(); - //bool singleQuoted = false; - //bool doubleQuoted = false; + // bool singleQuoted = false; + // bool doubleQuoted = false; bool readingIdentifier = false; while (_offset < input.Length) { diff --git a/src/System.Management.Automation/engine/ErrorPackage.cs b/src/System.Management.Automation/engine/ErrorPackage.cs index 3b41db3ba5..30c5f7856a 100644 --- a/src/System.Management.Automation/engine/ErrorPackage.cs +++ b/src/System.Management.Automation/engine/ErrorPackage.cs @@ -1147,7 +1147,7 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("fullyQualifiedErrorId"); } - //Mark this error record as serialized + // Mark this error record as serialized _isSerialized = true; _error = exception; _target = targetObject; @@ -1275,10 +1275,10 @@ namespace System.Management.Automation throw PSTraceSource.NewArgumentNullException("serializedErrorRecord"); } - //Get Exception + // Get Exception PSObject serializedException = RemotingDecoder.GetPropertyValue(serializedErrorRecord, "Exception"); - //Get Target object + // Get Target object object targetObject = RemotingDecoder.GetPropertyValue(serializedErrorRecord, "TargetObject"); string exceptionMessage = null; @@ -1291,27 +1291,27 @@ namespace System.Management.Automation } } - //Get FullyQualifiedErrorId + // Get FullyQualifiedErrorId string fullyQualifiedErrorId = RemotingDecoder.GetPropertyValue(serializedErrorRecord, "FullyQualifiedErrorId") ?? "fullyQualifiedErrorId"; - //Get ErrorCategory... + // Get ErrorCategory... ErrorCategory errorCategory = RemotingDecoder.GetPropertyValue(serializedErrorRecord, "errorCategory_Category"); - //Get Various ErrorCategory fileds + // Get Various ErrorCategory fileds string errorCategory_Activity = RemotingDecoder.GetPropertyValue(serializedErrorRecord, "ErrorCategory_Activity"); string errorCategory_Reason = RemotingDecoder.GetPropertyValue(serializedErrorRecord, "ErrorCategory_Reason"); string errorCategory_TargetName = RemotingDecoder.GetPropertyValue(serializedErrorRecord, "ErrorCategory_TargetName"); string errorCategory_TargetType = RemotingDecoder.GetPropertyValue(serializedErrorRecord, "ErrorCategory_TargetType"); string errorCategory_Message = RemotingDecoder.GetPropertyValue(serializedErrorRecord, "ErrorCategory_Message"); - //Get InvocationInfo (optional property) + // Get InvocationInfo (optional property) PSObject invocationInfo = Microsoft.PowerShell.DeserializingTypeConverter.GetPropertyValue( serializedErrorRecord, "InvocationInfo", Microsoft.PowerShell.DeserializingTypeConverter.RehydrationFlags.MissingPropertyOk); - //Get Error Detail (these note properties are optional, so can't right now use RemotingDecoder...) + // Get Error Detail (these note properties are optional, so can't right now use RemotingDecoder...) string errorDetails_Message = GetNoteValue(serializedErrorRecord, "ErrorDetails_Message") as string; @@ -1323,7 +1323,7 @@ namespace System.Management.Automation RemoteException re = new RemoteException((string.IsNullOrWhiteSpace(exceptionMessage) == false) ? exceptionMessage : errorCategory_Message, serializedException, invocationInfo); - //Create ErrorRecord + // Create ErrorRecord PopulateProperties( re, targetObject, diff --git a/src/System.Management.Automation/engine/EventManager.cs b/src/System.Management.Automation/engine/EventManager.cs index cd5eaf6049..30853abcfa 100644 --- a/src/System.Management.Automation/engine/EventManager.cs +++ b/src/System.Management.Automation/engine/EventManager.cs @@ -672,7 +672,7 @@ namespace System.Management.Automation EventInfo eventInfo = null; Type sourceType = source as Type ?? source.GetType(); - //PowerShell does not support WinRT events. + // PowerShell does not support WinRT events. if (WinRTHelper.IsWinRTType(sourceType)) { throw new InvalidOperationException(EventingResources.WinRTEventsNotSupported); diff --git a/src/System.Management.Automation/engine/ExecutionContext.cs b/src/System.Management.Automation/engine/ExecutionContext.cs index 52dd738c91..05d06267e0 100644 --- a/src/System.Management.Automation/engine/ExecutionContext.cs +++ b/src/System.Management.Automation/engine/ExecutionContext.cs @@ -685,7 +685,7 @@ namespace System.Management.Automation CommandOrigin commandOrigin = this.EngineSessionState.CurrentScope.ScopeOrigin; CommandProcessorBase commandProcessor = CommandDiscovery.LookupCommandProcessor(command, commandOrigin, !dotSource); - // Reset the command origin for script commands... //BUGBUG - dotting can get around command origin checks??? + // Reset the command origin for script commands... // BUGBUG - dotting can get around command origin checks??? if (commandProcessor != null && commandProcessor is ScriptCommandProcessorBase) { commandProcessor.Command.CommandOriginInternal = CommandOrigin.Internal; @@ -935,7 +935,7 @@ namespace System.Management.Automation /// The current connection object. /// private Runspace _currentRunspace; - //This should be internal, but it need to be friend of remoting dll. + // This should be internal, but it need to be friend of remoting dll. /// /// The current connection object. /// diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index df12fa68b9..a0f0dde001 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -273,10 +273,10 @@ namespace System.Management.Automation.Runspaces /// public bool IsRemove { get; } - //So that we can specify the type information on the fly, - //without using Types.ps1xml file - //public SessionStateTypeEntry(string name, xmlreader definition); - //public string Definition { get; } + // So that we can specify the type information on the fly, + // without using Types.ps1xml file + // public SessionStateTypeEntry(string name, xmlreader definition); + // public string Definition { get; } } /// @@ -372,10 +372,10 @@ namespace System.Management.Automation.Runspaces /// public ExtendedTypeDefinition FormatData { get; } - //So that we can specify the format information on the fly, - //without using Format.ps1xml file - //public SessionStateFormatEntry(string name, xmlreader definition); - //public string Definition { get; } + // So that we can specify the format information on the fly, + // without using Format.ps1xml file + // public SessionStateFormatEntry(string name, xmlreader definition); + // public string Definition { get; } } /// @@ -1262,7 +1262,7 @@ namespace System.Management.Automation.Runspaces private Collection _internalCollection; - //object to use for locking + // object to use for locking private object _syncObject = new object(); } @@ -1488,7 +1488,7 @@ namespace System.Management.Automation.Runspaces { InitialSessionState iss = new InitialSessionState(); - //TODO: the following code is probably needed for the hosted constrained runspace + // TODO: the following code is probably needed for the hosted constrained runspace // There are too many things that depend on the built-in variables. At the same time, // these variables can't be public or they become a security issue. // This change still needs to be spec-reviewed before turning it on. It also seems to @@ -1537,7 +1537,7 @@ namespace System.Management.Automation.Runspaces throw pse; } #if DEBUG - //NOTE: + // NOTE: // This code is for testing a module-based shell. It is only available when the shell is complied // in debug mode and is not intended to be a feature. // July 31 2008 - brucepay @@ -3794,7 +3794,7 @@ namespace System.Management.Automation.Runspaces { s_PSSnapInTracer.TraceError("Loading assembly for psSnapIn {0} failed", psSnapInInfo.Name); warning = null; - return null; //BUGBUG - should add something to the warnings list here instead of quitting... + return null; // BUGBUG - should add something to the warnings list here instead of quitting... } s_PSSnapInTracer.WriteLine("Loading assembly for psSnapIn {0} succeeded", psSnapInInfo.Name); @@ -4389,7 +4389,7 @@ end { RunspaceInit.FormatEnumerationLimitDescription ), - //variable for PSEmailServer + // variable for PSEmailServer new SessionStateVariableEntry( SpecialVariables.PSEmailServer, string.Empty, diff --git a/src/System.Management.Automation/engine/ManagementObjectAdapter.cs b/src/System.Management.Automation/engine/ManagementObjectAdapter.cs index 85ffd26256..b07f85c313 100644 --- a/src/System.Management.Automation/engine/ManagementObjectAdapter.cs +++ b/src/System.Management.Automation/engine/ManagementObjectAdapter.cs @@ -393,7 +393,7 @@ namespace System.Management.Automation protected override string PropertyToString(PSProperty property) { StringBuilder returnValue = new StringBuilder(); - //if (PropertyIsStatic(property)) + // if (PropertyIsStatic(property)) // { // returnValue.Append("static "); // } diff --git a/src/System.Management.Automation/engine/MinishellParameterBinderController.cs b/src/System.Management.Automation/engine/MinishellParameterBinderController.cs index 5e5f9ba756..36b4cd008b 100644 --- a/src/System.Management.Automation/engine/MinishellParameterBinderController.cs +++ b/src/System.Management.Automation/engine/MinishellParameterBinderController.cs @@ -338,9 +338,9 @@ namespace System.Management.Automation { ArrayList list = ConvertArgsValueToArrayList(value); - //Serialize the list + // Serialize the list StringWriter stringWriter = new StringWriter(System.Globalization.CultureInfo.InvariantCulture); - //When (if) switching to XmlTextWriter.Create remember the OmitXmlDeclaration difference + // When (if) switching to XmlTextWriter.Create remember the OmitXmlDeclaration difference XmlWriter xmlWriter = XmlWriter.Create(stringWriter); Serializer serializer = new Serializer(xmlWriter); serializer.Serialize(list); @@ -348,7 +348,7 @@ namespace System.Management.Automation xmlWriter.Flush(); string result = stringWriter.ToString(); - //convert result to encoded string + // convert result to encoded string return StringToBase64Converter.StringToBase64String(result); } diff --git a/src/System.Management.Automation/engine/Modules/GetModuleCommand.cs b/src/System.Management.Automation/engine/Modules/GetModuleCommand.cs index 7c9c21595b..4406b30589 100644 --- a/src/System.Management.Automation/engine/Modules/GetModuleCommand.cs +++ b/src/System.Management.Automation/engine/Modules/GetModuleCommand.cs @@ -221,7 +221,7 @@ namespace Microsoft.PowerShell.Commands ImportModuleOptions throwAwayOptions = new ImportModuleOptions(); moduleInfo = LoadModuleManifest( temporaryModuleManifestPath, - null, //scriptInfo + null, // scriptInfo mainData, localizedData, 0 /* - don't write errors, don't load elements, don't return null on first error */, diff --git a/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs b/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs index c3e4dc4fa4..52be13b9a1 100644 --- a/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs +++ b/src/System.Management.Automation/engine/Modules/ImportModuleCommand.cs @@ -1493,7 +1493,7 @@ namespace Microsoft.PowerShell.Commands // moduleInfo = LoadModuleManifest( temporaryModuleManifestPath, - null, //scriptInfo + null, // scriptInfo data, localizedData, ManifestProcessingFlags.LoadElements | ManifestProcessingFlags.WriteErrors | ManifestProcessingFlags.NullOnFirstError, diff --git a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs index 4ebb246e81..5325dc0787 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs @@ -947,7 +947,7 @@ namespace Microsoft.PowerShell.Commands containsWildCards = true; } - //Now we resolve the possible paths in case it is relative path/path contains wildcards + // Now we resolve the possible paths in case it is relative path/path contains wildcards var modulePathCollection = GetResolvedPathCollection(modulePath, this.Context); if (modulePathCollection != null) @@ -4512,10 +4512,10 @@ namespace Microsoft.PowerShell.Commands { // TODO, insivara : What happens when Enabled but none of the other options (DefaultSystemModules, NonDefaultSystemModule, NonSystemModule, SpecificModules) are set? // After input from GP team for this behavior, need to revisit the commented out part - //if ((status & ModuleLoggingGroupPolicyStatus.Enabled) != 0) - //{ + // if ((status & ModuleLoggingGroupPolicyStatus.Enabled) != 0) + // { - //} + // } if (((status & ModuleLoggingGroupPolicyStatus.Enabled) != 0) && moduleNames != null) { @@ -6610,7 +6610,7 @@ namespace Microsoft.PowerShell.Commands } catch (PSArgumentException) { - //BUGBUG - brucepay - probably want to have a verbose message here... + // BUGBUG - brucepay - probably want to have a verbose message here... } #endif diff --git a/src/System.Management.Automation/engine/Modules/ModuleUtils.cs b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs index 0923cb25f9..34c3348154 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleUtils.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs @@ -475,7 +475,7 @@ namespace System.Management.Automation.Internal tempModuleInfo.SetModuleBase(Utils.DefaultPowerShellAppBase); } - //moduleVersionRequired is bypassed by FullyQualifiedModule from calling method. This is the only place where guid will be involved. + // moduleVersionRequired is bypassed by FullyQualifiedModule from calling method. This is the only place where guid will be involved. if (moduleVersionRequired && modulePath.EndsWith(StringLiterals.PowerShellDataFileExtension, StringComparison.OrdinalIgnoreCase)) { tempModuleInfo.SetVersion(ModuleIntrinsics.GetManifestModuleVersion(modulePath)); diff --git a/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs b/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs index 3cbd97d55b..c093f40ffe 100644 --- a/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs +++ b/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs @@ -775,8 +775,8 @@ namespace Microsoft.PowerShell.Commands ///// Streamwriter to get end of line character from ///// The item of the manifest file for which names are being resolved. ///// The quoted list. - //private string QuoteFilesWithWildcard(string basePath, IEnumerable names, string allowedExtension, StreamWriter streamWriter, string item) - //{ + // private string QuoteFilesWithWildcard(string basePath, IEnumerable names, string allowedExtension, StreamWriter streamWriter, string item) + // { // if (names != null) // { // foreach (string name in names) @@ -837,7 +837,7 @@ namespace Microsoft.PowerShell.Commands // } // return QuoteNames(names, streamWriter); - //} + // } /// /// Glob a set of files then resolve them to relative paths. diff --git a/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs b/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs index 3044b65d32..584ee89c16 100644 --- a/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs +++ b/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs @@ -1613,10 +1613,10 @@ namespace System.Management.Automation { public bool Equals(PSModuleInfo x, PSModuleInfo y) { - //Check whether the compared objects reference the same data. + // Check whether the compared objects reference the same data. if (Object.ReferenceEquals(x, y)) return true; - //Check whether any of the compared objects is null. + // Check whether any of the compared objects is null. if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null)) return false; diff --git a/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs b/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs index 25428c2568..207c1f2a86 100644 --- a/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs +++ b/src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs @@ -130,7 +130,7 @@ namespace Microsoft.PowerShell.Commands if (module != null) { - //Validate file existence + // Validate file existence if (module.RequiredAssemblies != null) { foreach (string requiredAssembliespath in module.RequiredAssemblies) @@ -145,7 +145,7 @@ namespace Microsoft.PowerShell.Commands } } - //RootModule can be null, empty string or point to a valid .psm1, , .cdxml, .xaml or .dll. Anything else is invalid. + // RootModule can be null, empty string or point to a valid .psm1, , .cdxml, .xaml or .dll. Anything else is invalid. if (module.RootModule != null && module.RootModule != string.Empty) { string rootModuleExt = System.IO.Path.GetExtension(module.RootModule); @@ -336,7 +336,7 @@ namespace Microsoft.PowerShell.Commands return false; } - //Then, we validate if the path is under module scope + // Then, we validate if the path is under module scope if (verifyPathScope && !System.IO.Path.GetFullPath(path).StartsWith(System.IO.Path.GetFullPath(module.ModuleBase), StringComparison.OrdinalIgnoreCase)) { return false; diff --git a/src/System.Management.Automation/engine/MshCommandRuntime.cs b/src/System.Management.Automation/engine/MshCommandRuntime.cs index 6ac21dbc02..18d5547872 100644 --- a/src/System.Management.Automation/engine/MshCommandRuntime.cs +++ b/src/System.Management.Automation/engine/MshCommandRuntime.cs @@ -3132,7 +3132,7 @@ namespace System.Management.Automation internal bool UseTransactionFlagSet { get; private set; } = false; - //This is used so that people can tell whether the debug switch was specified. This + // This is used so that people can tell whether the debug switch was specified. This // Is useful in the Cmdlet-calling-Cmdlet case where you'd like the underlying Cmdlet to // have the same switches. private bool _debugFlag = false; @@ -3687,7 +3687,7 @@ namespace System.Management.Automation internal void RemoveVariableListsInPipe() { - //Diagnostics.Assert(thisCommand is PSScriptCmdlet, "this is only done for script cmdlets"); + // Diagnostics.Assert(thisCommand is PSScriptCmdlet, "this is only done for script cmdlets"); if (_outVarList != null) { diff --git a/src/System.Management.Automation/engine/MshObject.cs b/src/System.Management.Automation/engine/MshObject.cs index b3e705bd8f..28ae298a8f 100644 --- a/src/System.Management.Automation/engine/MshObject.cs +++ b/src/System.Management.Automation/engine/MshObject.cs @@ -1493,8 +1493,8 @@ namespace System.Management.Automation /// If an exception was thrown by the BaseObject's ToString. public override string ToString() { - //If ToString value from deserialization is available, - //simply return it. + // If ToString value from deserialization is available, + // simply return it. if (_toStringFromDeserialization != null) { return _toStringFromDeserialization; @@ -1514,8 +1514,8 @@ namespace System.Management.Automation /// If an exception was thrown by the BaseObject's ToString. public string ToString(string format, IFormatProvider formatProvider) { - //If ToString value from deserialization is available, - //simply return it. + // If ToString value from deserialization is available, + // simply return it. if (_toStringFromDeserialization != null) { return _toStringFromDeserialization; @@ -2044,7 +2044,7 @@ namespace System.Management.Automation } } - //This is toString value set on deserialization + // This is toString value set on deserialization private string _toStringFromDeserialization = null; internal bool preserveToString = false; diff --git a/src/System.Management.Automation/engine/NativeCommandProcessor.cs b/src/System.Management.Automation/engine/NativeCommandProcessor.cs index bd0f33023c..f62b6732a8 100644 --- a/src/System.Management.Automation/engine/NativeCommandProcessor.cs +++ b/src/System.Management.Automation/engine/NativeCommandProcessor.cs @@ -174,12 +174,12 @@ namespace System.Management.Automation this.CommandScope = context.EngineSessionState.CurrentScope; - //provide native command a backpointer to this object. - //When kill is called on the command object, - //it calls this NCP back to kill the process... + // provide native command a backpointer to this object. + // When kill is called on the command object, + // it calls this NCP back to kill the process... ((NativeCommand)Command).MyCommandProcessor = this; - //Create input writer for providing input to the process. + // Create input writer for providing input to the process. _inputWriter = new ProcessInputWriter(Command); _isTranscribing = this.Command.Context.EngineHostInterface.UI.IsTranscribing; @@ -290,11 +290,11 @@ namespace System.Management.Automation { _isPreparedCalled = true; - //Check if the application is minishell + // Check if the application is minishell _isMiniShell = IsMiniShell(); - //For minishell parameter binding is done in Complete method because we need - //to know if output is redirected before we can bind parameters. + // For minishell parameter binding is done in Complete method because we need + // to know if output is redirected before we can bind parameters. if (!_isMiniShell) { this.NativeParameterBinderController.BindParameters(arguments); @@ -434,12 +434,12 @@ namespace System.Management.Automation } } - //Start the process. If stop has been called, throw exception. - //Note: if StopProcessing is called which this method has the lock, - //Stop thread will wait for nativeProcess to start. - //If StopProcessing gets the lock first, then it will set the stopped - //flag and this method will throw PipelineStoppedException when it gets - //the lock. + // Start the process. If stop has been called, throw exception. + // Note: if StopProcessing is called which this method has the lock, + // Stop thread will wait for nativeProcess to start. + // If StopProcessing gets the lock first, then it will set the stopped + // flag and this method will throw PipelineStoppedException when it gets + // the lock. lock (_sync) { if (_stopped) @@ -525,7 +525,7 @@ namespace System.Management.Automation try { - //If input is redirected, start input to process. + // If input is redirected, start input to process. if (startInfo.RedirectStandardInput) { NativeCommandIOFormat inputFormat = NativeCommandIOFormat.Text; @@ -588,7 +588,7 @@ namespace System.Management.Automation private void InitOutputQueue() { - //if output is redirected, start reading output of process in queue. + // if output is redirected, start reading output of process in queue. if (_nativeProcess.StartInfo.RedirectStandardOutput || _nativeProcess.StartInfo.RedirectStandardError) { lock (_sync) @@ -667,7 +667,7 @@ namespace System.Management.Automation { if (_isRunningInBackground == false) { - //Wait for input writer to finish. + // Wait for input writer to finish. _inputWriter.Done(); // read all the available output in the blocking way @@ -978,7 +978,7 @@ namespace System.Management.Automation { if (!_runStandAlone) { - //Stop input writer + // Stop input writer _inputWriter.Stop(); KillProcess(_nativeProcess); @@ -1129,8 +1129,8 @@ namespace System.Management.Automation startInfo.UseShellExecute = true; } - //For minishell value of -outoutFormat parameter depends on value of redirectOutput. - //So we delay the parameter binding. Do parameter binding for minishell now. + // For minishell value of -outoutFormat parameter depends on value of redirectOutput. + // So we delay the parameter binding. Do parameter binding for minishell now. if (_isMiniShell) { MinishellParameterBinderController mpc = (MinishellParameterBinderController)NativeParameterBinderController; @@ -1229,8 +1229,8 @@ namespace System.Management.Automation } } - //In minishell scenario, if output is redirected - //then error should also be redirected. + // In minishell scenario, if output is redirected + // then error should also be redirected. if (redirectError == false && redirectOutput == true && _isMiniShell) { redirectError = true; @@ -1579,7 +1579,7 @@ namespace System.Management.Automation string streamName; object obj = des.Deserialize(out streamName); - //Decide the stream to which data belongs + // Decide the stream to which data belongs MinishellStream stream = MinishellStream.Unknown; if (streamName != null) { @@ -1591,7 +1591,7 @@ namespace System.Management.Automation stream = isOutput ? MinishellStream.Output : MinishellStream.Error; } - //Null is allowed only in output stream + // Null is allowed only in output stream if (stream != MinishellStream.Output && obj == null) { continue; @@ -1644,7 +1644,7 @@ namespace System.Management.Automation stream == MinishellStream.Verbose || stream == MinishellStream.Warning) { - //Convert to string + // Convert to string try { obj = LanguagePrimitives.ConvertTo(obj, typeof(string), CultureInfo.InvariantCulture); @@ -1792,9 +1792,9 @@ namespace System.Management.Automation { Dbg.Assert(process != null, "caller should validate the paramter"); - //Get the encoding for writing to native command. Note we get the Encoding - //from the current scope so a script or function can use a different encoding - //than global value. + // Get the encoding for writing to native command. Note we get the Encoding + // from the current scope so a script or function can use a different encoding + // than global value. Encoding pipeEncoding = _command.Context.GetVariableValue(SpecialVariables.OutputEncodingVarPath) as System.Text.Encoding ?? Utils.utf8NoBom; diff --git a/src/System.Management.Automation/engine/PSClassSearcher.cs b/src/System.Management.Automation/engine/PSClassSearcher.cs index 1ae1473fa1..17e819abef 100644 --- a/src/System.Management.Automation/engine/PSClassSearcher.cs +++ b/src/System.Management.Automation/engine/PSClassSearcher.cs @@ -166,7 +166,7 @@ namespace System.Management.Automation if (cachedClasses != null) { - //Exact match + // Exact match if (!_useWildCards) { if (cachedClasses.ContainsKey(_className)) diff --git a/src/System.Management.Automation/engine/ParameterBinderBase.cs b/src/System.Management.Automation/engine/ParameterBinderBase.cs index 8fb3d592a7..39b08596ec 100644 --- a/src/System.Management.Automation/engine/ParameterBinderBase.cs +++ b/src/System.Management.Automation/engine/ParameterBinderBase.cs @@ -1151,7 +1151,7 @@ namespace System.Management.Automation // Invalid types which cannot be associated with a bool // Since there is a catch block which appropriately // handles this situation we just throw an exception here - //throw new PSInvalidCastException(); + // throw new PSInvalidCastException(); ParameterBindingException pbe = new ParameterBindingException( ErrorCategory.InvalidArgument, @@ -1915,7 +1915,7 @@ namespace System.Management.Automation if (result == PositionUtilities.EmptyExtent) result = InvocationInfo.ScriptPosition; // Can't use this assertion - we don't have useful positions when invoked via PowerShell API - //Diagnostics.Assert(result != PositionUtilities.EmptyExtent, "We are missing a valid position somewhere"); + // Diagnostics.Assert(result != PositionUtilities.EmptyExtent, "We are missing a valid position somewhere"); return result; } @@ -1925,7 +1925,7 @@ namespace System.Management.Automation if (result == PositionUtilities.EmptyExtent) result = InvocationInfo.ScriptPosition; // Can't use this assertion - we don't have useful positions when invoked via PowerShell API - //Diagnostics.Assert(result != PositionUtilities.EmptyExtent, "We are missing a valid position somewhere"); + // Diagnostics.Assert(result != PositionUtilities.EmptyExtent, "We are missing a valid position somewhere"); return result; } diff --git a/src/System.Management.Automation/engine/ParameterBinderController.cs b/src/System.Management.Automation/engine/ParameterBinderController.cs index a25834979b..6bad34823b 100644 --- a/src/System.Management.Automation/engine/ParameterBinderController.cs +++ b/src/System.Management.Automation/engine/ParameterBinderController.cs @@ -1161,7 +1161,7 @@ namespace System.Management.Automation if (result == PositionUtilities.EmptyExtent) result = InvocationInfo.ScriptPosition; // Can't use this assertion - we don't have useful positions when invoked via PowerShell API - //Diagnostics.Assert(result != PositionUtilities.EmptyExtent, "We are missing a valid position somewhere"); + // Diagnostics.Assert(result != PositionUtilities.EmptyExtent, "We are missing a valid position somewhere"); return result; } @@ -1171,7 +1171,7 @@ namespace System.Management.Automation if (result == PositionUtilities.EmptyExtent) result = InvocationInfo.ScriptPosition; // Can't use this assertion - we don't have useful positions when invoked via PowerShell API - //Diagnostics.Assert(result != PositionUtilities.EmptyExtent, "We are missing a valid position somewhere"); + // Diagnostics.Assert(result != PositionUtilities.EmptyExtent, "We are missing a valid position somewhere"); return result; } diff --git a/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs b/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs index f8f2bd1143..b3008d8eba 100644 --- a/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateProviderAPIs.cs @@ -1323,14 +1323,14 @@ namespace System.Management.Automation foreach (ProviderInfo existingProvider in existingProviders) { - //making sure that we are not trying to add the same provider by checking the provider name & type of the new and existing providers. + // making sure that we are not trying to add the same provider by checking the provider name & type of the new and existing providers. if (string.IsNullOrEmpty(provider.PSSnapInName) && (string.Equals(existingProvider.Name, provider.Name, StringComparison.OrdinalIgnoreCase) && (existingProvider.GetType().Equals(provider.GetType())))) { isDuplicateProvider = true; } - //making sure that we are not trying to add the same provider by checking the PSSnapinName of the new and existing providers. + // making sure that we are not trying to add the same provider by checking the PSSnapinName of the new and existing providers. else if (string.Equals(existingProvider.PSSnapInName, provider.PSSnapInName, StringComparison.OrdinalIgnoreCase)) { isDuplicateProvider = true; diff --git a/src/System.Management.Automation/engine/SessionStateScope.cs b/src/System.Management.Automation/engine/SessionStateScope.cs index 56bca6ff37..b0c1bd3ff4 100644 --- a/src/System.Management.Automation/engine/SessionStateScope.cs +++ b/src/System.Management.Automation/engine/SessionStateScope.cs @@ -1569,7 +1569,7 @@ namespace System.Management.Automation // Remove the entry is the list is now empty if (cmdlets.Count == 0) { - //Remove the key + // Remove the key _cmdlets.Remove(name); return; } diff --git a/src/System.Management.Automation/engine/SessionStateVariableAPIs.cs b/src/System.Management.Automation/engine/SessionStateVariableAPIs.cs index 9a9e8e8d2a..1b0f8bfe4f 100644 --- a/src/System.Management.Automation/engine/SessionStateVariableAPIs.cs +++ b/src/System.Management.Automation/engine/SessionStateVariableAPIs.cs @@ -391,7 +391,7 @@ namespace System.Management.Automation { // Since more than one path was resolved, this is an error. - //Before throwing exception. Close the readers to avoid sharing violation. + // Before throwing exception. Close the readers to avoid sharing violation. foreach (IContentReader r in readers) { r.Close(); diff --git a/src/System.Management.Automation/engine/TypeTable.cs b/src/System.Management.Automation/engine/TypeTable.cs index 4a24a74706..f5f548933f 100644 --- a/src/System.Management.Automation/engine/TypeTable.cs +++ b/src/System.Management.Automation/engine/TypeTable.cs @@ -4467,12 +4467,12 @@ namespace System.Management.Automation.Runspaces typesInfo.Add(new SessionStateTypeEntry(filePath)); // TODO - use parallel foreach without causing any contention - //Parallel.ForEach(types, typeData => + // Parallel.ForEach(types, typeData => foreach (var typeData in types) { ProcessTypeDataToAdd(errors, typeData); } - //}); + // }); } private bool ProcessIsBuiltIn(string filePath, ConcurrentBag errors, out bool failToLoadFile) diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index 0021d209d0..dc553f79c9 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -1016,10 +1016,10 @@ namespace System.Management.Automation public FILETIME ftCreationTime; public FILETIME ftLastAccessTime; public FILETIME ftLastWriteTime; - public uint nFileSizeHigh; //changed all to uint, otherwise you run into unexpected overflow - public uint nFileSizeLow; //| - public uint dwReserved0; //| - public uint dwReserved1; //v + public uint nFileSizeHigh; // changed all to uint, otherwise you run into unexpected overflow + public uint nFileSizeLow; // | + public uint dwReserved0; // | + public uint dwReserved1; // v [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH)] public string cFileName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_ALTERNATE)] diff --git a/src/System.Management.Automation/engine/hostifaces/AsyncResult.cs b/src/System.Management.Automation/engine/hostifaces/AsyncResult.cs index 2214517c60..4886f7125b 100644 --- a/src/System.Management.Automation/engine/hostifaces/AsyncResult.cs +++ b/src/System.Management.Automation/engine/hostifaces/AsyncResult.cs @@ -128,7 +128,7 @@ namespace System.Management.Automation.Runspaces /// internal void SetAsCompleted(Exception exception) { - //Dbg.Assert(!isCompleted, "AsynResult already completed"); + // Dbg.Assert(!isCompleted, "AsynResult already completed"); if (IsCompleted) { return; diff --git a/src/System.Management.Automation/engine/hostifaces/Command.cs b/src/System.Management.Automation/engine/hostifaces/Command.cs index 2001f070b9..c05512ee0c 100644 --- a/src/System.Management.Automation/engine/hostifaces/Command.cs +++ b/src/System.Management.Automation/engine/hostifaces/Command.cs @@ -369,7 +369,7 @@ namespace System.Management.Automation.Runspaces if (_mergeUnclaimedPreviousCommandResults != PipelineResultTypes.None) { - //Currently only merging previous unclaimed error and output is supported. + // Currently only merging previous unclaimed error and output is supported. if (mcr != null) { mcr.MergeUnclaimedPreviousErrorResults = true; @@ -379,7 +379,7 @@ namespace System.Management.Automation.Runspaces // Error merge. if (MergeInstructions[(int)MergeType.Error] == PipelineResultTypes.Output) { - //Currently only merging error with output is supported. + // Currently only merging error with output is supported. mcr.ErrorMergeTo = MshCommandRuntime.MergeDataStream.Output; } @@ -541,7 +541,7 @@ namespace System.Management.Automation.Runspaces helpCategory); } - //Set the merge settings + // Set the merge settings SetMergeSettingsOnCommandProcessor(commandProcessorBase); return commandProcessorBase; diff --git a/src/System.Management.Automation/engine/hostifaces/Connection.cs b/src/System.Management.Automation/engine/hostifaces/Connection.cs index 582d385f33..f85f9068d3 100644 --- a/src/System.Management.Automation/engine/hostifaces/Connection.cs +++ b/src/System.Management.Automation/engine/hostifaces/Connection.cs @@ -1652,7 +1652,7 @@ namespace System.Management.Automation.Runspaces // Used for pipeline id generation. private long _pipelineIdSeed; - //Generate pipeline id unique to this runspace + // Generate pipeline id unique to this runspace internal long GeneratePipelineId() { return System.Threading.Interlocked.Increment(ref _pipelineIdSeed); diff --git a/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs b/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs index 4f28045b8f..6738667972 100644 --- a/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs +++ b/src/System.Management.Automation/engine/hostifaces/ConnectionBase.cs @@ -162,7 +162,7 @@ namespace System.Management.Automation.Runspaces { lock (SyncRoot) { - //Do not return internal state. + // Do not return internal state. return _runspaceStateInfo.Clone(); } } @@ -246,7 +246,7 @@ namespace System.Management.Automation.Runspaces if (etwEnabled) RunspaceEventSource.Log.OpenRunspaceStart(); lock (SyncRoot) { - //Call fails if RunspaceState is not BeforeOpen. + // Call fails if RunspaceState is not BeforeOpen. if (RunspaceState != RunspaceState.BeforeOpen) { InvalidRunspaceStateException e = @@ -262,7 +262,7 @@ namespace System.Management.Automation.Runspaces SetRunspaceState(RunspaceState.Opening); } - //Raise event outside the lock + // Raise event outside the lock RaiseRunspaceStateEvents(); OpenHelper(syncCall); @@ -395,13 +395,13 @@ namespace System.Management.Automation.Runspaces if (alreadyClosing) { - //Already closing is set to true if Runspace is already - //in closing. In this case wait for runspace to close. - //This can happen in two scenarios: - //1) User calls Runspace.Close from two threads. - //2) In remoting, some error from data structure handler layer can start - //runspace closure. At the same time, user can call - //remove runspace. + // Already closing is set to true if Runspace is already + // in closing. In this case wait for runspace to close. + // This can happen in two scenarios: + // 1) User calls Runspace.Close from two threads. + // 2) In remoting, some error from data structure handler layer can start + // runspace closure. At the same time, user can call + // remove runspace. // if (syncCall) @@ -412,10 +412,10 @@ namespace System.Management.Automation.Runspaces return; } - //Raise Event outside the lock + // Raise Event outside the lock RaiseRunspaceStateEvents(); - //Call the derived class implementation to do the actual work + // Call the derived class implementation to do the actual work CloseHelper(syncCall); } @@ -713,12 +713,12 @@ namespace System.Management.Automation.Runspaces { _runspaceStateInfo = new RunspaceStateInfo(state, reason); - //Add _runspaceStateInfo to _runspaceEventQueue. - //RaiseRunspaceStateEvents will raise event for each item - //in this queue. - //Note:We are doing clone here instead of passing the member - //_runspaceStateInfo because we donot want outside - //to change our runspace state. + // Add _runspaceStateInfo to _runspaceEventQueue. + // RaiseRunspaceStateEvents will raise event for each item + // in this queue. + // Note:We are doing clone here instead of passing the member + // _runspaceStateInfo because we donot want outside + // to change our runspace state. RunspaceAvailability previousAvailability = _runspaceAvailability; this.UpdateRunspaceAvailability(_runspaceStateInfo.State, false); @@ -762,9 +762,9 @@ namespace System.Management.Automation.Runspaces } else { - //Clear the events if there are no EventHandlers. This - //ensures that events do not get called for state - //changes prior to their registration. + // Clear the events if there are no EventHandlers. This + // ensures that events do not get called for state + // changes prior to their registration. _runspaceEventQueue.Clear(); } } @@ -781,8 +781,8 @@ namespace System.Management.Automation.Runspaces } #pragma warning disable 56500 - //Exception raised by events are not error condition for runspace - //object. + // Exception raised by events are not error condition for runspace + // object. if (stateChanged != null) { try @@ -847,9 +847,9 @@ namespace System.Management.Automation.Runspaces throw e; } - //Add the pipeline to list of Executing pipeline. - //Note:_runningPipelines is always accessed with the lock so - //there is no need to create a synchronized version of list + // Add the pipeline to list of Executing pipeline. + // Note:_runningPipelines is always accessed with the lock so + // there is no need to create a synchronized version of list RunningPipelines.Add(pipeline); _currentlyRunningPipeline = pipeline; } @@ -872,9 +872,9 @@ namespace System.Management.Automation.Runspaces Dbg.Assert(RunspaceState != RunspaceState.BeforeOpen, "Runspace should not be before open when pipeline is running"); - //Remove the pipeline to list of Executing pipeline. - //Note:_runningPipelines is always accessed with the lock so - //there is no need to create a synchronized version of list + // Remove the pipeline to list of Executing pipeline. + // Note:_runningPipelines is always accessed with the lock so + // there is no need to create a synchronized version of list RunningPipelines.Remove(pipeline); // Update the running pipeline @@ -897,13 +897,13 @@ namespace System.Management.Automation.Runspaces /// internal bool WaitForFinishofPipelines() { - //Take a snapshot of list of active pipelines. - //Note:Before we enter to this CloseHelper routine - //CoreClose has already set the state of Runspace - //to closing. So no new pipelines can be executed on this - //runspace and so no new pipelines will be added to - //_runningPipelines. However we still need to lock because - //running pipelines can be removed from this. + // Take a snapshot of list of active pipelines. + // Note:Before we enter to this CloseHelper routine + // CoreClose has already set the state of Runspace + // to closing. So no new pipelines can be executed on this + // runspace and so no new pipelines will be added to + // _runningPipelines. However we still need to lock because + // running pipelines can be removed from this. PipelineBase[] runningPipelines; lock (_pipelineListLock) @@ -963,7 +963,7 @@ namespace System.Management.Automation.Runspaces if (runningPipelines.Length > 0) { - //Start from the most recent pipeline. + // Start from the most recent pipeline. for (int i = runningPipelines.Length - 1; i >= 0; i--) { runningPipelines[i].Stop(); @@ -1020,22 +1020,22 @@ namespace System.Management.Automation.Runspaces lock (_pipelineListLock) { - //first check if this pipeline is in the list of running - //pipelines. It is possible that pipeline has already - //completed. + // first check if this pipeline is in the list of running + // pipelines. It is possible that pipeline has already + // completed. if (RunningPipelines.Contains(pipeline) == false) { return; } - //If this pipeline is currently running pipeline, - //then it does not have nested pipelines + // If this pipeline is currently running pipeline, + // then it does not have nested pipelines if (GetCurrentlyRunningPipeline() == pipeline) { return; } - //Build list of nested pipelines + // Build list of nested pipelines nestedPipelines = new List(); for (int i = RunningPipelines.Count - 1; i >= 0; i--) { @@ -1061,7 +1061,7 @@ namespace System.Management.Automation.Runspaces void DoConcurrentCheckAndAddToRunningPipelines(PipelineBase pipeline, bool syncCall) { - //Concurrency check should be done under runspace lock + // Concurrency check should be done under runspace lock lock (SyncRoot) { if (_bSessionStateProxyCallInProgress == true) @@ -1069,10 +1069,10 @@ namespace System.Management.Automation.Runspaces throw PSTraceSource.NewInvalidOperationException(RunspaceStrings.NoPipelineWhenSessionStateProxyInProgress); } - //Delegate to pipeline to do check if it is fine to invoke if another - //pipeline is running. + // Delegate to pipeline to do check if it is fine to invoke if another + // pipeline is running. pipeline.DoConcurrentCheck(syncCall, SyncRoot, true); - //Finally add to the list of running pipelines. + // Finally add to the list of running pipelines. AddToRunningPipelineList(pipeline); } } @@ -1146,9 +1146,9 @@ namespace System.Management.Automation.Runspaces #region session state proxy - //Note: When SessionStateProxy calls are in progress, - //pipeline cannot be invoked. Also when pipeline is in - //progress, SessionStateProxy calls cannot be made. + // Note: When SessionStateProxy calls are in progress, + // pipeline cannot be invoked. Also when pipeline is in + // progress, SessionStateProxy calls cannot be made. private bool _bSessionStateProxyCallInProgress; /// @@ -1208,7 +1208,7 @@ namespace System.Management.Automation.Runspaces } } - //Now we can invoke session state proxy + // Now we can invoke session state proxy _bSessionStateProxyCallInProgress = true; } } diff --git a/src/System.Management.Automation/engine/hostifaces/History.cs b/src/System.Management.Automation/engine/hostifaces/History.cs index 5f7e3cc090..0c268d47a0 100644 --- a/src/System.Management.Automation/engine/hostifaces/History.cs +++ b/src/System.Management.Automation/engine/hostifaces/History.cs @@ -170,8 +170,8 @@ namespace Microsoft.PowerShell.Commands internal History(ExecutionContext context) { - //Create history size variable. Add ValidateRangeAttribute to - //validate the range. + // Create history size variable. Add ValidateRangeAttribute to + // validate the range. Collection attrs = new Collection(); attrs.Add(new ValidateRangeAttribute(1, (int)Int16.MaxValue)); PSVariable historySizeVar = new PSVariable(SpecialVariables.HistorySize, DefaultHistorySize, ScopedItemOptions.None, attrs); @@ -302,24 +302,24 @@ namespace Microsoft.PowerShell.Commands lock (_syncRoot) { - //Using list instead of an array to store the entries.With array we are getting null values - //when the historybuffer size is changed + // Using list instead of an array to store the entries.With array we are getting null values + // when the historybuffer size is changed List entriesList = new List(); if (id > 0) { long firstId, baseId; baseId = id; - //get id,count,newest values + // get id,count,newest values if (!newest.IsPresent) { - //get older entries + // get older entries - //Calculate the first id (i.e lowest id to fetch) + // Calculate the first id (i.e lowest id to fetch) firstId = baseId - count + 1; - //If first id is less than the lowest id in history store, - //assign lowest id as first ID + // If first id is less than the lowest id in history store, + // assign lowest id as first ID if (firstId < 1) { firstId = 1; @@ -341,15 +341,15 @@ namespace Microsoft.PowerShell.Commands for (long i = firstId; i <= baseId; ++i) { - //if an entry is null after being cleared by clear-history cmdlet, - //continue with the next entry + // if an entry is null after being cleared by clear-history cmdlet, + // continue with the next entry if (_buffer[GetIndexFromId(i)] == null || _buffer[GetIndexFromId(i)].Cleared == true) continue; entriesList.Add(_buffer[GetIndexFromId(i)].Clone()); } } else - { //get latest entries + { // get latest entries // first id becomes the id +count no of entries from the end of the buffer firstId = baseId + count - 1; // if first id is more than the no of entries in the buffer, first id will be the last entry in the buffer @@ -373,8 +373,8 @@ namespace Microsoft.PowerShell.Commands for (long i = firstId; i >= baseId; --i) { - //if an entry is null after being cleared by clear-history cmdlet, - //continue with the next entry + // if an entry is null after being cleared by clear-history cmdlet, + // continue with the next entry if (_buffer[GetIndexFromId(i)] == null || _buffer[GetIndexFromId(i)].Cleared == true) continue; entriesList.Add(_buffer[GetIndexFromId(i)].Clone()); @@ -383,17 +383,17 @@ namespace Microsoft.PowerShell.Commands } else { - //get entries for count,newest + // get entries for count,newest long index, SmallestID = 0; - //if we change the defaulthistory size and when no of entries exceed the size, then - //we need to get the smallest entry in the buffer when we want to clear the oldest entry - //eg if size is 5 and then the entries can be 7,6,1,2,3 + // if we change the defaulthistory size and when no of entries exceed the size, then + // we need to get the smallest entry in the buffer when we want to clear the oldest entry + // eg if size is 5 and then the entries can be 7,6,1,2,3 if (_capacity != DefaultHistorySize) SmallestID = SmallestIDinBuffer(); if (!newest.IsPresent) { - //get oldest count entries + // get oldest count entries index = 1; if (_capacity != DefaultHistorySize) { @@ -438,7 +438,7 @@ namespace Microsoft.PowerShell.Commands { index--; continue; } else { - //clone the entry from the history buffer + // clone the entry from the history buffer entriesList.Add(_buffer[GetIndexFromId(index)].Clone()); i--; index--; } @@ -481,7 +481,7 @@ namespace Microsoft.PowerShell.Commands List cmdlist = new List(); long SmallestID = 1; - //if buffersize is changes,Get the smallest entry that's not cleared in the buffer + // if buffersize is changes,Get the smallest entry that's not cleared in the buffer if (_capacity != DefaultHistorySize) SmallestID = SmallestIDinBuffer(); if (count != 0) @@ -511,7 +511,7 @@ namespace Microsoft.PowerShell.Commands long id = _countEntriesAdded; for (long i = 0; i <= count - 1;) { - //if buffersize is changed,we have to loop from max entry to min entry thats not cleared + // if buffersize is changed,we have to loop from max entry to min entry thats not cleared if (_capacity != DefaultHistorySize) { if (_countEntriesAdded > _capacity) @@ -614,13 +614,13 @@ namespace Microsoft.PowerShell.Commands _buffer[GetIndexForNewEntry()] = entry; - //Increment count of entries added so far + // Increment count of entries added so far _countEntriesAdded++; - //Id of an entry in history is same as its number in history store. + // Id of an entry in history is same as its number in history store. entry.SetId(_countEntriesAdded); - //Increment count of entries in buffer by 1 + // Increment count of entries in buffer by 1 IncrementCountOfEntriesInBuffer(); return _countEntriesAdded; @@ -663,14 +663,14 @@ namespace Microsoft.PowerShell.Commands return minID; for (int i = 0; i < _buffer.Length; i++) { - //assign the first entry in the buffer as min. + // assign the first entry in the buffer as min. if (_buffer[i] != null && _buffer[i].Cleared == false) { minID = _buffer[i].Id; break; } } - //check for the minimum id that is not cleared + // check for the minimum id that is not cleared for (int i = 0; i < _buffer.Length; i++) { if (_buffer[i] != null && _buffer[i].Cleared == false) @@ -686,7 +686,7 @@ namespace Microsoft.PowerShell.Commands /// private void ReallocateBufferIfNeeded() { - //Get current value of histoysize variable + // Get current value of histoysize variable int historySize = GetHistorySize(); if (historySize == _capacity) @@ -694,10 +694,10 @@ namespace Microsoft.PowerShell.Commands HistoryInfo[] tempBuffer = new HistoryInfo[historySize]; - //Calculate number of entries to copy in new buffer. + // Calculate number of entries to copy in new buffer. int numberOfEntries = _countEntriesInBuffer; - //when buffer size is changed,we have to consider the totalnumber of entries added + // when buffer size is changed,we have to consider the totalnumber of entries added if (numberOfEntries < _countEntriesAdded) numberOfEntries = (int)_countEntriesAdded; @@ -891,8 +891,8 @@ namespace Microsoft.PowerShell.Commands { if (!_countParameterSpecified) { - //If Id parameter is specified and count is not specified, - //get history + // If Id parameter is specified and count is not specified, + // get history foreach (long id in _id) { Dbg.Assert(id > 0, "ValidateRangeAttribute should not allow this"); @@ -1002,7 +1002,7 @@ namespace Microsoft.PowerShell.Commands { if (_id != null) { - //Id has been set already. + // Id has been set already. _multipleIdProvided = true; } @@ -1017,8 +1017,8 @@ namespace Microsoft.PowerShell.Commands /// protected override void EndProcessing() { - //Invoke-history can execute only one command. If multiple - //ids were provided, throw exception + // Invoke-history can execute only one command. If multiple + // ids were provided, throw exception if (_multipleIdProvided == true) { Exception ex = @@ -1042,10 +1042,10 @@ namespace Microsoft.PowerShell.Commands History history = ((LocalRunspace)Context.CurrentRunspace).History; Dbg.Assert(history != null, "History should be non null"); - //Get the history entry to invoke + // Get the history entry to invoke HistoryInfo entry = GetHistoryEntryToInvoke(history); - //Check if there is a loop in invoke-history + // Check if there is a loop in invoke-history LocalPipeline pipeline = (LocalPipeline)((LocalRunspace)Context.CurrentRunspace).GetCurrentlyRunningPipeline(); if (pipeline.PresentInInvokeHistoryEntryList(entry) == false) @@ -1072,10 +1072,10 @@ namespace Microsoft.PowerShell.Commands ); } - //Replace Invoke-History with string which is getting invoked + // Replace Invoke-History with string which is getting invoked ReplaceHistoryString(entry); - //Now invoke the command + // Now invoke the command string commandToInvoke = entry.CommandLine; if (ShouldProcess(commandToInvoke) == false) @@ -1085,13 +1085,13 @@ namespace Microsoft.PowerShell.Commands try { - //Echo command + // Echo command Host.UI.WriteLine(commandToInvoke); } catch (HostException) { - //when the host is not interactive, HostException is thrown - //do nothing + // when the host is not interactive, HostException is thrown + // do nothing } // Items invoked as History should act as though they were submitted by the user - so should still come from @@ -1144,8 +1144,8 @@ namespace Microsoft.PowerShell.Commands { HistoryInfo entry = null; - //User didn't specify any input parameter. Invoke the last - //entry + // User didn't specify any input parameter. Invoke the last + // entry if (_id == null) { HistoryInfo[] entries = history.GetEntries(0, 1, true); @@ -1176,10 +1176,10 @@ namespace Microsoft.PowerShell.Commands } else { - //Parse input + // Parse input PopulateIdAndCommandLine(); - //User specified a commandline. Get list of all history entries - //and find latest match + // User specified a commandline. Get list of all history entries + // and find latest match if (_commandLine != null) { HistoryInfo[] entries = history.GetEntries(0, -1, false); @@ -1238,7 +1238,7 @@ namespace Microsoft.PowerShell.Commands } else { - //Retrieve the command at the index we've specified + // Retrieve the command at the index we've specified entry = history.GetEntry(_historyId); if (entry == null || entry.Id != _historyId) { @@ -1303,7 +1303,7 @@ namespace Microsoft.PowerShell.Commands /// private void ReplaceHistoryString(HistoryInfo entry) { - //Get the current pipeline + // Get the current pipeline LocalPipeline pipeline = (LocalPipeline)((LocalRunspace)Context.CurrentRunspace).GetCurrentlyRunningPipeline(); if (pipeline.AddToHistory) { @@ -1349,13 +1349,13 @@ namespace Microsoft.PowerShell.Commands override void BeginProcessing() { - //Get currently running pipeline and add history entry for - //this pipeline. - //Note:Generally History entry for current pipeline is added - //on completion of pipeline (See LocalPipeline implementation). - //However Add-history adds additional entries in to history and - //additional entries must be added after history for current pipeline. - //This is done by adding the history entry for current pipeline below. + // Get currently running pipeline and add history entry for + // this pipeline. + // Note:Generally History entry for current pipeline is added + // on completion of pipeline (See LocalPipeline implementation). + // However Add-history adds additional entries in to history and + // additional entries must be added after history for current pipeline. + // This is done by adding the history entry for current pipeline below. LocalPipeline lpl = (LocalPipeline)((RunspaceBase)Context.CurrentRunspace).GetCurrentlyRunningPipeline(); lpl.AddHistoryEntryFromAddHistoryCmdlet(); } @@ -1374,8 +1374,8 @@ namespace Microsoft.PowerShell.Commands { foreach (PSObject input in InputObject) { - //Wrap the inputobject in PSObject and convert it to - //HistoryInfo object. + // Wrap the inputobject in PSObject and convert it to + // HistoryInfo object. HistoryInfo infoToAdd = GetHistoryInfoObject(input); if (infoToAdd != null) { @@ -1420,14 +1420,14 @@ namespace Microsoft.PowerShell.Commands { break; } - //Read CommandLine property + // Read CommandLine property string commandLine = GetPropertyValue(mshObject, "CommandLine") as string; if (commandLine == null) { break; } - //Read ExecutionStatus property + // Read ExecutionStatus property object pipelineState = GetPropertyValue(mshObject, "ExecutionStatus"); if (pipelineState == null) { @@ -1470,7 +1470,7 @@ namespace Microsoft.PowerShell.Commands break; } - //Read StartExecutionTime property + // Read StartExecutionTime property DateTime startExecutionTime; object temp = GetPropertyValue(mshObject, "StartExecutionTime"); if (temp == null) @@ -1497,7 +1497,7 @@ namespace Microsoft.PowerShell.Commands break; } - //Read EndExecutionTime property + // Read EndExecutionTime property DateTime endExecutionTime; temp = GetPropertyValue(mshObject, "EndExecutionTime"); if (temp == null) @@ -1534,7 +1534,7 @@ namespace Microsoft.PowerShell.Commands ); } while (false); - //If we are here, an error has occured. + // If we are here, an error has occured. Exception ex = new InvalidDataException ( @@ -1699,7 +1699,7 @@ namespace Microsoft.PowerShell.Commands protected override void ProcessRecord() { - //case statement to identify the parameter set + // case statement to identify the parameter set switch (ParameterSetName.ToString()) { case "IDParameter": @@ -1800,7 +1800,7 @@ namespace Microsoft.PowerShell.Commands } else {// if id,count adn newest parameters are present - //throw an exception for invalid count values + // throw an exception for invalid count values long id = _id[0]; Dbg.Assert(id > 0, "ValidateRangeAttribute should not allow this"); @@ -1937,9 +1937,9 @@ namespace Microsoft.PowerShell.Commands } else { - //creates a wild card pattern + // creates a wild card pattern WildcardPattern wildcardpattern = WildcardPattern.Get(cmdline, WildcardOptions.IgnoreCase); - //count set to zero if not specified. + // count set to zero if not specified. if (!_countParameterSpecified && WildcardPattern.ContainsWildcardCharacters(cmdline)) { count = 0; @@ -1949,7 +1949,7 @@ namespace Microsoft.PowerShell.Commands _entries = _history.GetEntries(wildcardpattern, count, newest); } - //Clear the History value. + // Clear the History value. foreach (HistoryInfo entry in _entries) { if (entry != null && entry.Cleared == false) diff --git a/src/System.Management.Automation/engine/hostifaces/InternalHostRawUserInterface.cs b/src/System.Management.Automation/engine/hostifaces/InternalHostRawUserInterface.cs index c4b6e5ebfa..d310d2fd05 100644 --- a/src/System.Management.Automation/engine/hostifaces/InternalHostRawUserInterface.cs +++ b/src/System.Management.Automation/engine/hostifaces/InternalHostRawUserInterface.cs @@ -365,8 +365,8 @@ namespace System.Management.Automation.Internal.Host } catch (PipelineStoppedException) { - //PipelineStoppedException is thrown by host when it wants - //to stop the pipeline. + // PipelineStoppedException is thrown by host when it wants + // to stop the pipeline. LocalPipeline lpl = (LocalPipeline)((RunspaceBase)_parentHost.Context.CurrentRunspace).GetCurrentlyRunningPipeline(); if (lpl == null) { diff --git a/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs b/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs index 0eabfd1be7..64ca6a86bc 100644 --- a/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs +++ b/src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs @@ -106,8 +106,8 @@ namespace System.Management.Automation.Internal.Host } catch (PipelineStoppedException) { - //PipelineStoppedException is thrown by host when it wants - //to stop the pipeline. + // PipelineStoppedException is thrown by host when it wants + // to stop the pipeline. LocalPipeline lpl = (LocalPipeline)((RunspaceBase)_parent.Context.CurrentRunspace).GetCurrentlyRunningPipeline(); if (lpl == null) { @@ -145,8 +145,8 @@ namespace System.Management.Automation.Internal.Host } catch (PipelineStoppedException) { - //PipelineStoppedException is thrown by host when it wants - //to stop the pipeline. + // PipelineStoppedException is thrown by host when it wants + // to stop the pipeline. LocalPipeline lpl = (LocalPipeline)((RunspaceBase)_parent.Context.CurrentRunspace).GetCurrentlyRunningPipeline(); if (lpl == null) { @@ -752,8 +752,8 @@ namespace System.Management.Automation.Internal.Host } catch (PipelineStoppedException) { - //PipelineStoppedException is thrown by host when it wants - //to stop the pipeline. + // PipelineStoppedException is thrown by host when it wants + // to stop the pipeline. LocalPipeline lpl = (LocalPipeline)((RunspaceBase)_parent.Context.CurrentRunspace).GetCurrentlyRunningPipeline(); if (lpl == null) { @@ -795,8 +795,8 @@ namespace System.Management.Automation.Internal.Host } catch (PipelineStoppedException) { - //PipelineStoppedException is thrown by host when it wants - //to stop the pipeline. + // PipelineStoppedException is thrown by host when it wants + // to stop the pipeline. LocalPipeline lpl = (LocalPipeline)((RunspaceBase)_parent.Context.CurrentRunspace).GetCurrentlyRunningPipeline(); if (lpl == null) { @@ -860,8 +860,8 @@ namespace System.Management.Automation.Internal.Host } catch (PipelineStoppedException) { - //PipelineStoppedException is thrown by host when it wants - //to stop the pipeline. + // PipelineStoppedException is thrown by host when it wants + // to stop the pipeline. LocalPipeline lpl = (LocalPipeline)((RunspaceBase)_parent.Context.CurrentRunspace).GetCurrentlyRunningPipeline(); if (lpl == null) { diff --git a/src/System.Management.Automation/engine/hostifaces/LocalConnection.cs b/src/System.Management.Automation/engine/hostifaces/LocalConnection.cs index e538f47069..48691695e0 100644 --- a/src/System.Management.Automation/engine/hostifaces/LocalConnection.cs +++ b/src/System.Management.Automation/engine/hostifaces/LocalConnection.cs @@ -582,12 +582,12 @@ namespace System.Management.Automation.Runspaces { if (syncCall) { - //Open runspace synchronously + // Open runspace synchronously DoOpenHelper(); } else { - //Open runspace in another thread + // Open runspace in another thread Thread asyncThread = new Thread(new ThreadStart(this.OpenThreadProc)); asyncThread.Start(); @@ -606,8 +606,8 @@ namespace System.Management.Automation.Runspaces } catch (Exception) { - //This exception is reported by raising RunspaceState - //change event. + // This exception is reported by raising RunspaceState + // change event. } #pragma warning restore 56500 } @@ -636,7 +636,7 @@ namespace System.Management.Automation.Runspaces _engine = new AutomationEngine(Host, InitialSessionState); _engine.Context.CurrentRunspace = this; - //Log engine for start of engine life + // Log engine for start of engine life MshLog.LogEngineLifecycleEvent(_engine.Context, EngineState.Available); startLifeCycleEventWritten = true; @@ -652,32 +652,32 @@ namespace System.Management.Automation.Runspaces { s_runspaceInitTracer.WriteLine("Runspace open failed"); - //Log engine health event + // Log engine health event LogEngineHealthEvent(exception); - //Log engine for end of engine life + // Log engine for end of engine life if (startLifeCycleEventWritten) { Dbg.Assert(_engine.Context != null, "if startLifeCycleEventWritten is true, ExecutionContext must be present"); MshLog.LogEngineLifecycleEvent(_engine.Context, EngineState.Stopped); } - //Open failed. Set the RunspaceState to Broken. + // Open failed. Set the RunspaceState to Broken. SetRunspaceState(RunspaceState.Broken, exception); - //Raise the event + // Raise the event RaiseRunspaceStateEvents(); - //Rethrow the exception. For asynchronous execution, - //OpenThreadProc will catch it. For synchronous execution - //caller of open will catch it. + // Rethrow the exception. For asynchronous execution, + // OpenThreadProc will catch it. For synchronous execution + // caller of open will catch it. throw; } SetRunspaceState(RunspaceState.Opened); RunspaceOpening.Set(); - //Raise the event + // Raise the event RaiseRunspaceStateEvents(); s_runspaceInitTracer.WriteLine("runspace opened successfully"); @@ -773,12 +773,12 @@ namespace System.Management.Automation.Runspaces { if (syncCall) { - //Do close synchronously + // Do close synchronously DoCloseHelper(); } else { - //Do close asynchronously + // Do close asynchronously Thread asyncThread = new Thread(new ThreadStart(this.CloseThreadProc)); asyncThread.Start(); @@ -844,19 +844,19 @@ namespace System.Management.Automation.Runspaces if (Events != null) Events.GenerateEvent(PSEngineEvent.Exiting, null, new object[] { }, null, true, false); - //Stop all running pipelines - //Note:Do not perform the Cancel in lock. Reason is - //Pipeline executes in separate thread, say threadP. - //When pipeline is canceled/failed/completed in - //Pipeline.ExecuteThreadProc it removes the pipeline - //from the list of running pipelines. threadP will need - //lock to remove the pipelines from the list of running pipelines - //And we will deadlock. - //Note:It is possible that one or more pipelines in the list - //of active pipelines have completed before we call cancel. - //That is fine since Pipeline.Cancel handles that( It ignores - //the cancel request if pipeline execution has already - //completed/failed/canceled. + // Stop all running pipelines + // Note:Do not perform the Cancel in lock. Reason is + // Pipeline executes in separate thread, say threadP. + // When pipeline is canceled/failed/completed in + // Pipeline.ExecuteThreadProc it removes the pipeline + // from the list of running pipelines. threadP will need + // lock to remove the pipelines from the list of running pipelines + // And we will deadlock. + // Note:It is possible that one or more pipelines in the list + // of active pipelines have completed before we call cancel. + // That is fine since Pipeline.Cancel handles that( It ignores + // the cancel request if pipeline execution has already + // completed/failed/canceled. StopPipelines(); // Disconnect all disconnectable jobs in the job repository. @@ -875,18 +875,18 @@ namespace System.Management.Automation.Runspaces return runspaces; }); - //Notify Engine components that that runspace is closing. + // Notify Engine components that that runspace is closing. _engine.Context.RunspaceClosingNotification(); - //Log engine lifecycle event. + // Log engine lifecycle event. MshLog.LogEngineLifecycleEvent(_engine.Context, EngineState.Stopped); - //All pipelines have been canceled. Close the runspace. + // All pipelines have been canceled. Close the runspace. _engine = null; SetRunspaceState(RunspaceState.Closed); - //Raise Event + // Raise Event RaiseRunspaceStateEvents(); if (closeAllOpenRunspaces) @@ -1428,8 +1428,8 @@ namespace System.Management.Automation.Runspaces return; } - //remoteRunspace.Dispose(); - //remoteRunspace = null; + // remoteRunspace.Dispose(); + // remoteRunspace = null; RaiseOperationCompleteEvent(); } diff --git a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs index d284958d6e..fbdfc439e2 100644 --- a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs +++ b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs @@ -140,14 +140,14 @@ namespace System.Management.Automation.Runspaces throw PSTraceSource.NewObjectDisposedException("pipeline"); } - //Note:This method is called from within a lock by parent class. There - //is no need to lock further. + // Note:This method is called from within a lock by parent class. There + // is no need to lock further. - //Use input stream in two cases: - //1)inputStream is open. In this case PipelineProcessor - //will call Invoke only if at least one object is added - //to inputStream. - //2)inputStream is closed but there are objects in the stream. + // Use input stream in two cases: + // 1)inputStream is open. In this case PipelineProcessor + // will call Invoke only if at least one object is added + // to inputStream. + // 2)inputStream is closed but there are objects in the stream. // NTRAID#Windows Out Of Band Releases-925566-2005/12/09-JonN // Remember this here, in the synchronous thread, // to avoid timing dependencies in the pipeline thread. @@ -284,15 +284,15 @@ namespace System.Management.Automation.Runspaces { #if TRANSACTIONS_SUPPORTED // 2004/11/08-JeffJon - //Transactions will not be supported for the Exchange release + // Transactions will not be supported for the Exchange release - //Add the transaction to this thread + // Add the transaction to this thread System.Transactions.Transaction.Current = this.LocalRunspace.ExecutionContext.CurrentTransaction; #endif - //Raise the event for Pipeline.Running + // Raise the event for Pipeline.Running RaisePipelineStateEvents(); - //Add this pipeline to history + // Add this pipeline to history RecordPipelineStartTime(); // Add automatic transcription, but don't transcribe nested commands @@ -336,7 +336,7 @@ namespace System.Management.Automation.Runspaces try { - //Create PipelineProcessor to invoke this pipeline + // Create PipelineProcessor to invoke this pipeline pipelineProcessor = CreatePipelineProcessor(); } catch (Exception ex) @@ -350,7 +350,7 @@ namespace System.Management.Automation.Runspaces throw; } - //Supply input stream to PipelineProcessor + // Supply input stream to PipelineProcessor // NTRAID#Windows Out Of Band Releases-925566-2005/12/09-JonN if (_useExternalInput) @@ -375,7 +375,7 @@ namespace System.Management.Automation.Runspaces try { - //Add this pipeline to stopper + // Add this pipeline to stopper _stopper.Push(pipelineProcessor); // Preserve the last value of $? across non-interactive commands. @@ -395,9 +395,9 @@ namespace System.Management.Automation.Runspaces this.LocalRunspace.ExecutionContext.ResetRedirection(); } - //Invoke the pipeline. - //Note:Since we are using pipes for output, return array is - //be empty. + // Invoke the pipeline. + // Note:Since we are using pipes for output, return array is + // be empty. try { pipelineProcessor.SynchronousExecuteEnumerate(AutomationNull.Value); @@ -502,7 +502,7 @@ namespace System.Management.Automation.Runspaces if (!IsChild) LocalRunspace.ExecutionContext.InternalHost.InternalUI.SetInformationalMessageBuffers(null); - //Pop the pipeline processor from stopper. + // Pop the pipeline processor from stopper. _stopper.Pop(false); if (!AddToHistory) @@ -588,7 +588,7 @@ namespace System.Management.Automation.Runspaces Microsoft.PowerShell.NativeCultureResolver.SetThreadUILanguage(0); } - //Put Execution Context In TLS + // Put Execution Context In TLS Runspace.DefaultRunspace = this.LocalRunspace; FlowControlException flowControlException = InvokeHelper(); @@ -649,12 +649,12 @@ namespace System.Management.Automation.Runspaces LocalRunspace.ExecutionContext.InternalHost.RevertHostRef(); } - //Remove Execution Context From TLS + // Remove Execution Context From TLS Runspace.DefaultRunspace = previousDefaultRunspace; - //If incomplete parse exception is hit, we should not add to history. - //This is ensure that in case of multiline commands, command is in the - //history only once. + // If incomplete parse exception is hit, we should not add to history. + // This is ensure that in case of multiline commands, command is in the + // history only once. if (!incompleteParseException) { try @@ -681,7 +681,7 @@ namespace System.Management.Automation.Runspaces // IsChild makes it possible for LocalPipeline to differentiate // between a true v1 nested pipeline and the "Cmdlets Calling Cmdlets" case. - //Close the output stream if it is not closed. + // Close the output stream if it is not closed. if (OutputStream.IsOpen && !IsChild) { try @@ -693,7 +693,7 @@ namespace System.Management.Automation.Runspaces } } - //Close the error stream if it is not closed. + // Close the error stream if it is not closed. if (ErrorStream.IsOpen && !IsChild) { try @@ -705,7 +705,7 @@ namespace System.Management.Automation.Runspaces } } - //Close the input stream if it is not closed. + // Close the input stream if it is not closed. if (InputStream.IsOpen && !IsChild) { try @@ -720,19 +720,19 @@ namespace System.Management.Automation.Runspaces // Clear stream links from ExecutionContext ClearStreams(); - //Runspace object maintains a list of pipelines in execution. - //Remove this pipeline from the list. This method also calls the - //pipeline finished event. + // Runspace object maintains a list of pipelines in execution. + // Remove this pipeline from the list. This method also calls the + // pipeline finished event. LocalRunspace.RemoveFromRunningPipelineList(this); - //If async call raise the event here. For sync invoke call, - //thread on which invoke is called will raise the event. + // If async call raise the event here. For sync invoke call, + // thread on which invoke is called will raise the event. if (!SyncInvokeCall) { - //This should be called after signaling PipelineFinishedEvent and - //RemoveFromRunningPipelineList. If it is done before, and in the - //Event, Runspace.Close is called which waits for pipeline to close. - //We will have deadlock + // This should be called after signaling PipelineFinishedEvent and + // RemoveFromRunningPipelineList. If it is done before, and in the + // Event, Runspace.Close is called which waits for pipeline to close. + // We will have deadlock RaisePipelineStateEvents(); } } @@ -788,12 +788,12 @@ namespace System.Management.Automation.Runspaces // Ensure that any saved debugger stop is released LocalRunspace.ReleaseDebugger(); - //first stop all child pipelines of this pipeline + // first stop all child pipelines of this pipeline LocalRunspace.StopNestedPipelines(this); - //close the input pipe if it hasn't been closed. - //This would release the pipeline thread if it is - //waiting for input. + // close the input pipe if it hasn't been closed. + // This would release the pipeline thread if it is + // waiting for input. if (InputStream.IsOpen) { try @@ -806,7 +806,7 @@ namespace System.Management.Automation.Runspaces } _stopper.Stop(); - //Wait for pipeline to finish + // Wait for pipeline to finish PipelineFinishedEvent.WaitOne(); } @@ -994,7 +994,7 @@ namespace System.Management.Automation.Runspaces } } - //History object for this pipeline + // History object for this pipeline private DateTime _pipelineStartTime; /// @@ -1011,7 +1011,7 @@ namespace System.Management.Automation.Runspaces /// private void AddHistoryEntry(bool skipIfLocked) { - //History id is greater than zero if entry was added to history + // History id is greater than zero if entry was added to history if (AddToHistory) { LocalRunspace.History.AddEntry(InstanceId, HistoryString, PipelineState, _pipelineStartTime, DateTime.Now, skipIfLocked); @@ -1032,10 +1032,10 @@ namespace System.Management.Automation.Runspaces internal void AddHistoryEntryFromAddHistoryCmdlet() { - //This method can be called by multiple times during a single - //pipeline execution. For ex: a script can execute add-history - //command multiple times. However we should add entry only - //once. + // This method can be called by multiple times during a single + // pipeline execution. For ex: a script can execute add-history + // command multiple times. However we should add entry only + // once. if (_historyIdForThisPipeline != -1) { return; @@ -1428,14 +1428,14 @@ namespace System.Management.Automation.Runspaces } } - //Note: after _stopping is set to true, nothing can be pushed/popped - //from stack and it is safe to call stop on PipelineProcessors in stack - //outside the lock - //Note: you want to do below loop outside the lock so that - //pipeline execution thread doesn't get blocked on Push and Pop. - //Note: A copy of the stack is made because we "unstop" a stopped - //pipeline to execute finally blocks. We don't want to stop pipelines - //in the finally block though. + // Note: after _stopping is set to true, nothing can be pushed/popped + // from stack and it is safe to call stop on PipelineProcessors in stack + // outside the lock + // Note: you want to do below loop outside the lock so that + // pipeline execution thread doesn't get blocked on Push and Pop. + // Note: A copy of the stack is made because we "unstop" a stopped + // pipeline to execute finally blocks. We don't want to stop pipelines + // in the finally block though. foreach (PipelineProcessor pp in copyStack) { pp.Stop(); diff --git a/src/System.Management.Automation/engine/hostifaces/NativeCultureResolver.cs b/src/System.Management.Automation/engine/hostifaces/NativeCultureResolver.cs index 2cfd780274..f53035d6c2 100644 --- a/src/System.Management.Automation/engine/hostifaces/NativeCultureResolver.cs +++ b/src/System.Management.Automation/engine/hostifaces/NativeCultureResolver.cs @@ -99,7 +99,7 @@ namespace Microsoft.PowerShell } } - //no fallbacks..just return base parent + // no fallbacks..just return base parent return base.Parent; } } @@ -478,7 +478,7 @@ namespace Microsoft.PowerShell [DllImport("kernel32.dll", SetLastError = false, CharSet = CharSet.Unicode)] internal static extern Int16 SetThreadUILanguage(Int16 langId); - //private static int MUI_LANGUAGE_ID = 0x4; + // private static int MUI_LANGUAGE_ID = 0x4; private static int s_MUI_LANGUAGE_NAME = 0x8; private static int s_MUI_CONSOLE_FILTER = 0x100; private static int s_MUI_MERGE_USER_FALLBACK = 0x20; diff --git a/src/System.Management.Automation/engine/hostifaces/Parameter.cs b/src/System.Management.Automation/engine/hostifaces/Parameter.cs index fc5455365e..e9c1d525f8 100644 --- a/src/System.Management.Automation/engine/hostifaces/Parameter.cs +++ b/src/System.Management.Automation/engine/hostifaces/Parameter.cs @@ -267,7 +267,7 @@ namespace System.Management.Automation.Runspaces /// public sealed class CommandParameterCollection : Collection { - //TODO: this class needs a mechanism to lock further changes + // TODO: this class needs a mechanism to lock further changes /// /// Create a new empty instance of this collection type. diff --git a/src/System.Management.Automation/engine/hostifaces/PowerShell.cs b/src/System.Management.Automation/engine/hostifaces/PowerShell.cs index 7987cec9ab..3cb598968e 100644 --- a/src/System.Management.Automation/engine/hostifaces/PowerShell.cs +++ b/src/System.Management.Automation/engine/hostifaces/PowerShell.cs @@ -4798,8 +4798,8 @@ namespace System.Management.Automation // Acquire lock as we are going to change state here.. lock (_syncObject) { - //BUGBUG: remote powershell appears to handle state change's differently - //Need to speak with remoting dev and resolve this. + // BUGBUG: remote powershell appears to handle state change's differently + // Need to speak with remoting dev and resolve this. switch (InvocationStateInfo.State) { case PSInvocationState.NotStarted: diff --git a/src/System.Management.Automation/engine/hostifaces/RunspacePoolInternal.cs b/src/System.Management.Automation/engine/hostifaces/RunspacePoolInternal.cs index 7f75d561bd..a984fc7164 100644 --- a/src/System.Management.Automation/engine/hostifaces/RunspacePoolInternal.cs +++ b/src/System.Management.Automation/engine/hostifaces/RunspacePoolInternal.cs @@ -997,7 +997,7 @@ namespace System.Management.Automation.Runspaces.Internal if (isAsync) { AsyncResult asyncResult = new RunspacePoolAsyncResult(instanceId, callback, asyncState, true); - //Open pool in another thread + // Open pool in another thread ThreadPool.QueueUserWorkItem(new WaitCallback(OpenThreadProc), asyncResult); return asyncResult; } @@ -1155,7 +1155,7 @@ namespace System.Management.Automation.Runspaces.Internal if (isAsync) { RunspacePoolAsyncResult asyncResult = new RunspacePoolAsyncResult(instanceId, callback, asyncState, false); - //Open pool in another thread + // Open pool in another thread ThreadPool.QueueUserWorkItem(new WaitCallback(CloseThreadProc), asyncResult); return asyncResult; } @@ -1402,7 +1402,7 @@ namespace System.Management.Automation.Runspaces.Internal runspaceList.Clear(); } - //Start from the most recent runspace. + // Start from the most recent runspace. for (int index = runspaceListCopy.Count - 1; index >= 0; index--) { // close runspaces suppress exceptions @@ -1627,7 +1627,7 @@ namespace System.Management.Automation.Runspaces.Internal { if (stateInfo.State != RunspacePoolState.BeforeOpen) { - //Call fails if RunspacePoolState is not BeforeOpen. + // Call fails if RunspacePoolState is not BeforeOpen. InvalidRunspacePoolStateException e = new InvalidRunspacePoolStateException ( diff --git a/src/System.Management.Automation/engine/hostifaces/internalHostuserInterfacesecurity.cs b/src/System.Management.Automation/engine/hostifaces/internalHostuserInterfacesecurity.cs index 8b9f13a51f..6cf8dd0bd6 100644 --- a/src/System.Management.Automation/engine/hostifaces/internalHostuserInterfacesecurity.cs +++ b/src/System.Management.Automation/engine/hostifaces/internalHostuserInterfacesecurity.cs @@ -58,8 +58,8 @@ namespace System.Management.Automation.Internal.Host } catch (PipelineStoppedException) { - //PipelineStoppedException is thrown by host when it wants - //to stop the pipeline. + // PipelineStoppedException is thrown by host when it wants + // to stop the pipeline. LocalPipeline lpl = (LocalPipeline)((RunspaceBase)_parent.Context.CurrentRunspace).GetCurrentlyRunningPipeline(); if (lpl == null) { diff --git a/src/System.Management.Automation/engine/hostifaces/pipelinebase.cs b/src/System.Management.Automation/engine/hostifaces/pipelinebase.cs index 14225d74e3..ea3e286e37 100644 --- a/src/System.Management.Automation/engine/hostifaces/pipelinebase.cs +++ b/src/System.Management.Automation/engine/hostifaces/pipelinebase.cs @@ -36,7 +36,7 @@ namespace System.Management.Automation.Runspaces { Initialize(runspace, command, addToHistory, isNested); - //Initialize streams + // Initialize streams InputStream = new ObjectStream(); OutputStream = new ObjectStream(); ErrorStream = new ObjectStream(); @@ -105,7 +105,7 @@ namespace System.Management.Automation.Runspaces AddToHistory = addToHistory; } - //Initialize streams + // Initialize streams InputStream = inputStream; OutputStream = outputStream; ErrorStream = errorStream; @@ -205,7 +205,7 @@ namespace System.Management.Automation.Runspaces { lock (SyncRoot) { - //Note:We do not return internal state. + // Note:We do not return internal state. return _pipelineStateInfo.Clone(); } } @@ -286,7 +286,7 @@ namespace System.Management.Automation.Runspaces /// else asynchronously. private void CoreStop(bool syncCall) { - //Is pipeline already in stopping state. + // Is pipeline already in stopping state. bool alreadyStopping = false; lock (SyncRoot) { @@ -297,14 +297,14 @@ namespace System.Management.Automation.Runspaces SetPipelineState(PipelineState.Stopped); break; - //If pipeline execution has failed or completed or - //stoped, return silently. + // If pipeline execution has failed or completed or + // stoped, return silently. case PipelineState.Stopped: case PipelineState.Completed: case PipelineState.Failed: return; - //If pipeline is in Stopping state, ignore the second - //stop. + // If pipeline is in Stopping state, ignore the second + // stop. case PipelineState.Stopping: alreadyStopping = true; break; @@ -315,9 +315,9 @@ namespace System.Management.Automation.Runspaces } } - //If pipeline is already in stopping state. Wait for pipeline - //to finish. We do need to raise any events here as no - //change of state has occurred. + // If pipeline is already in stopping state. Wait for pipeline + // to finish. We do need to raise any events here as no + // change of state has occurred. if (alreadyStopping) { if (syncCall) @@ -328,25 +328,25 @@ namespace System.Management.Automation.Runspaces return; } - //Raise the event outside the lock + // Raise the event outside the lock RaisePipelineStateEvents(); - //A pipeline can be stoped before it is started. See NotStarted - //case in above switch statement. This is done to allow stoping a pipeline - //in another thread before it has been started. + // A pipeline can be stoped before it is started. See NotStarted + // case in above switch statement. This is done to allow stoping a pipeline + // in another thread before it has been started. lock (SyncRoot) { if (PipelineState == PipelineState.Stopped) { - //Note:if we have reached here, Stopped state was set - //in PipelineState.NotStarted case above. Only other - //way Stopped can be set when this method calls - //StopHelper below + // Note:if we have reached here, Stopped state was set + // in PipelineState.NotStarted case above. Only other + // way Stopped can be set when this method calls + // StopHelper below return; } } - //Start stop operation in derived class + // Start stop operation in derived class ImplementStop(syncCall); } @@ -384,14 +384,14 @@ namespace System.Management.Automation.Runspaces CoreInvoke(input, true); - //Wait for pipeline to finish execution + // Wait for pipeline to finish execution PipelineFinishedEvent.WaitOne(); if (SyncInvokeCall) { - //Raise the pipeline completion events. These events are set in - //pipeline execution thread. However for Synchronous execution - //we raise the event in the main thread. + // Raise the pipeline completion events. These events are set in + // pipeline execution thread. However for Synchronous execution + // we raise the event in the main thread. RaisePipelineStateEvents(); } @@ -411,7 +411,7 @@ namespace System.Management.Automation.Runspaces throw PipelineStateInfo.Reason; } - //Execution completed successfully + // Execution completed successfully // 2004/06/30-JonN was ReadAll() which was non-blocking return Output.NonBlockingRead(Int32.MaxValue); } @@ -493,14 +493,14 @@ namespace System.Management.Automation.Runspaces if (syncCall && !(InputStream is PSDataCollectionStream || InputStream is PSDataCollectionStream)) { - //Method is called from synchronous invoke. + // Method is called from synchronous invoke. if (input != null) { - //TO-DO-Add a test make sure that ObjectDisposed - //exception is thrown - //Write input data in to inputStream and close the input - //pipe. If Input stream is already closed an - //ObjectDisposed exception will be thrown + // TO-DO-Add a test make sure that ObjectDisposed + // exception is thrown + // Write input data in to inputStream and close the input + // pipe. If Input stream is already closed an + // ObjectDisposed exception will be thrown foreach (object temp in input) { InputStream.Write(temp); @@ -512,42 +512,42 @@ namespace System.Management.Automation.Runspaces SyncInvokeCall = syncCall; - //Create event which will be signalled when pipeline execution - //is completed/failed/stoped. - //Note:Runspace.Close waits for all the running pipeline - //to finish. This Event must be created before pipeline is - //added to list of running pipelines. This avoids the race condition - //where Close is called after pipeline is added to list of - //running pipeline but before event is created. + // Create event which will be signalled when pipeline execution + // is completed/failed/stoped. + // Note:Runspace.Close waits for all the running pipeline + // to finish. This Event must be created before pipeline is + // added to list of running pipelines. This avoids the race condition + // where Close is called after pipeline is added to list of + // running pipeline but before event is created. PipelineFinishedEvent = new ManualResetEvent(false); - //1) Do the check to ensure that pipeline no other + // 1) Do the check to ensure that pipeline no other // pipeline is running. - //2) Runspace object maintains a list of pipelines in - //execution. Add this pipeline to the list. + // 2) Runspace object maintains a list of pipelines in + // execution. Add this pipeline to the list. RunspaceBase.DoConcurrentCheckAndAddToRunningPipelines(this, syncCall); - //Note: Set PipelineState to Running only after adding pipeline to list - //of pipelines in execution. AddForExecution checks that runspace is in - //state where pipeline can be run. - //StartPipelineExecution raises this event. See Windows Bug 1160481 for - //more details. + // Note: Set PipelineState to Running only after adding pipeline to list + // of pipelines in execution. AddForExecution checks that runspace is in + // state where pipeline can be run. + // StartPipelineExecution raises this event. See Windows Bug 1160481 for + // more details. SetPipelineState(PipelineState.Running); } try { - //Let the derived class start the pipeline execution. + // Let the derived class start the pipeline execution. StartPipelineExecution(); } catch (Exception exception) { - //If we fail in any of the above three steps, set the correct states. + // If we fail in any of the above three steps, set the correct states. RunspaceBase.RemoveFromRunningPipelineList(this); SetPipelineState(PipelineState.Failed, exception); - //Note: we are not raising the events in this case. However this is - //fine as user is getting the exception. + // Note: we are not raising the events in this case. However this is + // fine as user is getting the exception. throw; } } @@ -801,12 +801,12 @@ namespace System.Management.Automation.Runspaces { _pipelineStateInfo = new PipelineStateInfo(state, reason); - //Add _pipelineStateInfo to _executionEventQueue. - //RaisePipelineStateEvents will raise event for each item - //in this queue. - //Note:We are doing clone here instead of passing the member - //_pipelineStateInfo because we donot want outside - //to change pipeline state. + // Add _pipelineStateInfo to _executionEventQueue. + // RaisePipelineStateEvents will raise event for each item + // in this queue. + // Note:We are doing clone here instead of passing the member + // _pipelineStateInfo because we donot want outside + // to change pipeline state. RunspaceAvailability previousAvailability = _runspace.RunspaceAvailability; _runspace.UpdateRunspaceAvailability(_pipelineStateInfo.State, false); @@ -850,9 +850,9 @@ namespace System.Management.Automation.Runspaces } else { - //Clear the events if there are no EventHandlers. This - //ensures that events do not get called for state - //changes prior to their registration. + // Clear the events if there are no EventHandlers. This + // ensures that events do not get called for state + // changes prior to their registration. _executionEventQueue.Clear(); } } @@ -870,8 +870,8 @@ namespace System.Management.Automation.Runspaces // this is shipped as part of V1. So disabling the warning here. #pragma warning disable 56500 - //Exception raised in the eventhandler are not error in pipeline. - //silently ignore them. + // Exception raised in the eventhandler are not error in pipeline. + // silently ignore them. if (stateChanged != null) { try @@ -959,8 +959,8 @@ namespace System.Management.Automation.Runspaces #region history - //History information is internal so that Pipeline serialization code - //can access it. + // History information is internal so that Pipeline serialization code + // can access it. /// /// if true, this pipeline is added in history. diff --git a/src/System.Management.Automation/engine/interpreter/BranchLabel.cs b/src/System.Management.Automation/engine/interpreter/BranchLabel.cs index 95313dc526..919a7b0610 100644 --- a/src/System.Management.Automation/engine/interpreter/BranchLabel.cs +++ b/src/System.Management.Automation/engine/interpreter/BranchLabel.cs @@ -86,7 +86,7 @@ namespace System.Management.Automation.Interpreter internal void Mark(InstructionList instructions) { - //ContractUtils.Requires(_targetIndex == UnknownIndex && _stackDepth == UnknownDepth && _continuationStackDepth == UnknownDepth); + // ContractUtils.Requires(_targetIndex == UnknownIndex && _stackDepth == UnknownDepth && _continuationStackDepth == UnknownDepth); _stackDepth = instructions.CurrentStackDepth; _continuationStackDepth = instructions.CurrentContinuationsDepth; diff --git a/src/System.Management.Automation/engine/interpreter/ControlFlowInstructions.cs b/src/System.Management.Automation/engine/interpreter/ControlFlowInstructions.cs index 1d6eed6ffa..f546106f0c 100644 --- a/src/System.Management.Automation/engine/interpreter/ControlFlowInstructions.cs +++ b/src/System.Management.Automation/engine/interpreter/ControlFlowInstructions.cs @@ -783,7 +783,7 @@ namespace System.Management.Automation.Interpreter return; } - //PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Interpreted loop compiled"); + // PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Interpreted loop compiled"); InterpretedFrame frame = (InterpretedFrame)frameObj; var compiler = new LoopCompiler(_loop, frame.Interpreter.LabelMapping, _variables, _closureVariables, _instructionIndex, _loopEnd); diff --git a/src/System.Management.Automation/engine/interpreter/InterpretedFrame.cs b/src/System.Management.Automation/engine/interpreter/InterpretedFrame.cs index a56f8f0c28..0ce038ff4f 100644 --- a/src/System.Management.Automation/engine/interpreter/InterpretedFrame.cs +++ b/src/System.Management.Automation/engine/interpreter/InterpretedFrame.cs @@ -140,7 +140,7 @@ namespace System.Management.Automation.Interpreter public static bool IsInterpretedFrame(MethodBase method) { - //ContractUtils.RequiresNotNull(method, "method"); + // ContractUtils.RequiresNotNull(method, "method"); return method.DeclaringType == typeof(Interpreter) && method.Name == "Run"; } diff --git a/src/System.Management.Automation/engine/interpreter/LightCompiler.cs b/src/System.Management.Automation/engine/interpreter/LightCompiler.cs index f63b0cd31a..cd2bd6ad1d 100644 --- a/src/System.Management.Automation/engine/interpreter/LightCompiler.cs +++ b/src/System.Management.Automation/engine/interpreter/LightCompiler.cs @@ -194,7 +194,7 @@ namespace System.Management.Automation.Interpreter private class DebugInfoComparer : IComparer { - //We allow comparison between int and DebugInfo here + // We allow comparison between int and DebugInfo here int IComparer.Compare(DebugInfo d1, DebugInfo d2) { if (d1.Index > d2.Index) return 1; @@ -205,22 +205,22 @@ namespace System.Management.Automation.Interpreter public static DebugInfo GetMatchingDebugInfo(DebugInfo[] debugInfos, int index) { - //Create a faked DebugInfo to do the search + // Create a faked DebugInfo to do the search DebugInfo d = new DebugInfo { Index = index }; - //to find the closest debug info before the current index + // to find the closest debug info before the current index int i = Array.BinarySearch(debugInfos, d, s_debugComparer); if (i < 0) { - //~i is the index for the first bigger element - //if there is no bigger element, ~i is the length of the array + // ~i is the index for the first bigger element + // if there is no bigger element, ~i is the length of the array i = ~i; if (i == 0) { return null; } - //return the last one that is smaller + // return the last one that is smaller i = i - 1; } @@ -339,7 +339,7 @@ namespace System.Management.Automation.Interpreter return new LightDelegateCreator(MakeInterpreter(node.Name), node); } - //internal LightDelegateCreator CompileTop(LightLambdaExpression node) { + // internal LightDelegateCreator CompileTop(LightLambdaExpression node) { // foreach (var p in node.Parameters) { // var local = _locals.DefineLocal(p, 0); // _instructions.EmitInitializeParameter(local.Index); @@ -355,7 +355,7 @@ namespace System.Management.Automation.Interpreter // Debug.Assert(_instructions.CurrentStackDepth == (node.ReturnType != typeof(void) ? 1 : 0)); // // return new LightDelegateCreator(MakeInterpreter(node.Name), node); - //} + // } private Interpreter MakeInterpreter(string lambdaName) { @@ -425,11 +425,11 @@ namespace System.Management.Automation.Interpreter } } - //private void EnsureVariable(ParameterExpression variable) { + // private void EnsureVariable(ParameterExpression variable) { // if (!_locals.ContainsVariable(variable)) { // EnsureAvailableForClosure(variable); // } - //} + // } private LocalVariable ResolveLocal(ParameterExpression variable) { @@ -1473,9 +1473,9 @@ namespace System.Management.Automation.Interpreter if (handler.Filter != null) { - //PushLabelBlock(LabelScopeKind.Filter); + // PushLabelBlock(LabelScopeKind.Filter); throw new NotImplementedException(); - //PopLabelBlock(LabelScopeKind.Filter); + // PopLabelBlock(LabelScopeKind.Filter); } var parameter = handler.Variable ?? Expression.Parameter(handler.Test); @@ -1805,7 +1805,7 @@ namespace System.Management.Automation.Interpreter } // TODO: do not create a new Call Expression - //if (PlatformAdaptationLayer.IsCompactFramework) { + // if (PlatformAdaptationLayer.IsCompactFramework) { // // Workaround for a bug in Compact Framework // Compile( // AstUtils.Convert( @@ -1817,9 +1817,9 @@ namespace System.Management.Automation.Interpreter // node.Type // ) // ); - //} else { + // } else { CompileMethodCallExpression(Expression.Call(node.Expression, node.Expression.Type.GetMethod("Invoke"), node.Arguments)); - //} + // } } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "expr")] diff --git a/src/System.Management.Automation/engine/interpreter/LightDelegateCreator.cs b/src/System.Management.Automation/engine/interpreter/LightDelegateCreator.cs index cee0480c20..3916a006ad 100644 --- a/src/System.Management.Automation/engine/interpreter/LightDelegateCreator.cs +++ b/src/System.Management.Automation/engine/interpreter/LightDelegateCreator.cs @@ -45,11 +45,11 @@ namespace System.Management.Automation.Interpreter _lambda = lambda; } - //internal LightDelegateCreator(Interpreter interpreter, LightLambdaExpression lambda) { + // internal LightDelegateCreator(Interpreter interpreter, LightLambdaExpression lambda) { // Assert.NotNull(lambda); // _interpreter = interpreter; // _lambda = lambda; - //} + // } internal Interpreter Interpreter { @@ -122,7 +122,7 @@ namespace System.Management.Automation.Interpreter } return null; - //return ((LightLambdaExpression)_lambda).Type; + // return ((LightLambdaExpression)_lambda).Type; } } @@ -163,7 +163,7 @@ namespace System.Management.Automation.Interpreter return; } - //PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Interpreted lambda compiled"); + // PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Interpreted lambda compiled"); // Interpreter needs a standard delegate type. // So change the lambda's delegate type to Func<...> or @@ -192,10 +192,10 @@ namespace System.Management.Automation.Interpreter Type delegateType; bool isVoid = lambda.ReturnType == typeof(void); - //if (isVoid && lambda.Parameters.Count == 2 && + // if (isVoid && lambda.Parameters.Count == 2 && // lambda.Parameters[0].IsByRef && lambda.Parameters[1].IsByRef) { // return typeof(ActionRef<,>).MakeGenericType(lambda.Parameters.Map(p => p.Type)); - //} else { + // } else { Type[] types = lambda.Parameters.Map(p => p.IsByRef ? p.Type.MakeByRefType() : p.Type); if (isVoid) { @@ -214,7 +214,7 @@ namespace System.Management.Automation.Interpreter } return lambda.Type; - //} + // } } } } diff --git a/src/System.Management.Automation/engine/interpreter/LightLambda.cs b/src/System.Management.Automation/engine/interpreter/LightLambda.cs index 08f6ebe32d..3bf38da35b 100644 --- a/src/System.Management.Automation/engine/interpreter/LightLambda.cs +++ b/src/System.Management.Automation/engine/interpreter/LightLambda.cs @@ -157,10 +157,10 @@ namespace System.Management.Automation.Interpreter return s_runCache[delegateType] = lambda => targetMethod.CreateDelegate(delegateType, lambda); } - //TODO enable sharing of these custom delegates + // TODO enable sharing of these custom delegates private Delegate CreateCustomDelegate(Type delegateType) { - //PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Synchronously compiling a custom delegate"); + // PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Synchronously compiling a custom delegate"); var method = delegateType.GetMethod("Invoke"); var paramInfos = method.GetParameters(); @@ -252,10 +252,10 @@ namespace System.Management.Automation.Interpreter internal void RunVoidRef2(ref T0 arg0, ref T1 arg1) { - //if (_compiled != null || TryGetCompiled()) { + // if (_compiled != null || TryGetCompiled()) { // ((ActionRef)_compiled)(ref arg0, ref arg1); // return; - //} + // } // copy in and copy out for today... var frame = MakeFrame(); diff --git a/src/System.Management.Automation/engine/interpreter/LocalAccess.cs b/src/System.Management.Automation/engine/interpreter/LocalAccess.cs index c2c70f1432..7b0711b193 100644 --- a/src/System.Management.Automation/engine/interpreter/LocalAccess.cs +++ b/src/System.Management.Automation/engine/interpreter/LocalAccess.cs @@ -59,7 +59,7 @@ namespace System.Management.Automation.Interpreter public override int Run(InterpretedFrame frame) { frame.Data[frame.StackIndex++] = frame.Data[_index]; - //frame.Push(frame.Data[_index]); + // frame.Push(frame.Data[_index]); return +1; } @@ -159,7 +159,7 @@ namespace System.Management.Automation.Interpreter public override int Run(InterpretedFrame frame) { frame.Data[_index] = frame.Data[--frame.StackIndex]; - //frame.Data[_index] = frame.Pop(); + // frame.Data[_index] = frame.Pop(); return +1; } diff --git a/src/System.Management.Automation/engine/interpreter/LocalVariables.cs b/src/System.Management.Automation/engine/interpreter/LocalVariables.cs index 56d676f72d..97908c8b2b 100644 --- a/src/System.Management.Automation/engine/interpreter/LocalVariables.cs +++ b/src/System.Management.Automation/engine/interpreter/LocalVariables.cs @@ -150,8 +150,8 @@ namespace System.Management.Automation.Interpreter public LocalDefinition DefineLocal(ParameterExpression variable, int start) { - //ContractUtils.RequiresNotNull(variable, "variable"); - //ContractUtils.Requires(start >= 0, "start", "start must be positive"); + // ContractUtils.RequiresNotNull(variable, "variable"); + // ContractUtils.Requires(start >= 0, "start", "start must be positive"); LocalVariable result = new LocalVariable(_localCount++, false, false); _maxLocalCount = System.Math.Max(_localCount, _maxLocalCount); diff --git a/src/System.Management.Automation/engine/interpreter/Utilities.cs b/src/System.Management.Automation/engine/interpreter/Utilities.cs index 859414a453..b1e527102f 100644 --- a/src/System.Management.Automation/engine/interpreter/Utilities.cs +++ b/src/System.Management.Automation/engine/interpreter/Utilities.cs @@ -149,7 +149,7 @@ namespace System.Management.Automation.Interpreter if (types.Length > MaximumArity || types.Any(t => t.IsByRef)) { throw Assert.Unreachable; - //return MakeCustomDelegate(types); + // return MakeCustomDelegate(types); } Type returnType = types[types.Length - 1]; @@ -292,7 +292,7 @@ namespace System.Management.Automation.Interpreter public object GetArgument(int index) { - //ContractUtils.RequiresArrayIndex(_arguments, index, "index"); + // ContractUtils.RequiresArrayIndex(_arguments, index, "index"); return _arguments[_first + index]; } @@ -308,7 +308,7 @@ namespace System.Management.Automation.Interpreter ); } - //[CLSCompliant(false)] + // [CLSCompliant(false)] public static object GetArg(ArgumentArray array, int index) { return array._arguments[array._first + index]; @@ -968,7 +968,7 @@ namespace System.Management.Automation.Interpreter public static Expression Void(Expression expression) { - //ContractUtils.RequiresNotNull(expression, "expression"); + // ContractUtils.RequiresNotNull(expression, "expression"); if (expression.Type == typeof(void)) { return expression; @@ -989,7 +989,7 @@ namespace System.Management.Automation.Interpreter public static Expression Convert(Expression expression, Type type) { - //ContractUtils.RequiresNotNull(expression, "expression"); + // ContractUtils.RequiresNotNull(expression, "expression"); if (expression.Type == type) { @@ -1071,8 +1071,8 @@ namespace System.Management.Automation.Interpreter { internal static bool TrueForAll(this IEnumerable collection, Predicate predicate) { - //ContractUtils.RequiresNotNull(collection, "collection"); - //ContractUtils.RequiresNotNull(predicate, "predicate"); + // ContractUtils.RequiresNotNull(collection, "collection"); + // ContractUtils.RequiresNotNull(predicate, "predicate"); foreach (T item in collection) { diff --git a/src/System.Management.Automation/engine/parser/Parser.cs b/src/System.Management.Automation/engine/parser/Parser.cs index 8617441115..64ab026657 100644 --- a/src/System.Management.Automation/engine/parser/Parser.cs +++ b/src/System.Management.Automation/engine/parser/Parser.cs @@ -42,7 +42,7 @@ namespace System.Management.Automation.Language private bool _inConfiguration; private ParseMode _parseMode; - //private bool _v3FeatureUsed; + // private bool _v3FeatureUsed; internal string _fileName; internal bool ProduceV2Tokens { get; set; } @@ -334,7 +334,7 @@ namespace System.Management.Automation.Language } } - //public bool V3FeatureUsed { get { return _v3FeatureUsed; } } + // public bool V3FeatureUsed { get { return _v3FeatureUsed; } } internal List ErrorList { get; } @@ -563,7 +563,7 @@ namespace System.Management.Automation.Language internal void NoteV3FeatureUsed() { - //_v3FeatureUsed = true; + // _v3FeatureUsed = true; } internal void RequireStatementTerminator() @@ -672,7 +672,7 @@ namespace System.Management.Automation.Language internal static IScriptExtent ExtentOf(Ast first, IScriptExtent last) { return ExtentOf(first.Extent, last); } internal static IScriptExtent ExtentOf(Token first, IScriptExtent last) { return ExtentOf(first.Extent, last); } - //private static IScriptExtent Before(Ast ast) { return Before(ast.Extent); } + // private static IScriptExtent Before(Ast ast) { return Before(ast.Extent); } internal static IScriptExtent Before(Token token) { return Before(token.Extent); } @@ -789,12 +789,12 @@ namespace System.Management.Automation.Language private ScriptBlockAst ScriptBlockRule(Token lCurly, bool isFilter, StatementAst predefinedStatementAst) { - //G script-block: - //G using-statements:opt param-block:opt statement-terminators:opt script-block-body:opt - //G - //G using-statements: - //G using-statement - //G using-statements using-statement + // G script-block: + // G using-statements:opt param-block:opt statement-terminators:opt script-block-body:opt + // G + // G using-statements: + // G using-statement + // G using-statements using-statement // We could set the mode here, but we can avoid rescanning keywords if the caller // sets the mode before skipping newlines. @@ -860,9 +860,9 @@ namespace System.Management.Automation.Language private ParamBlockAst ParamBlockRule() { - //G param-block: - //G new-lines:opt attribute-list:opt new-lines:opt 'param' new-lines:opt - //G '(' parameter-list:opt new-lines:opt ')' + // G param-block: + // G new-lines:opt attribute-list:opt new-lines:opt 'param' new-lines:opt + // G '(' parameter-list:opt new-lines:opt ')' SkipNewlines(); List candidateAttributes = AttributeListRule(false); @@ -881,7 +881,7 @@ namespace System.Management.Automation.Language { UngetToken(lparen); - //This is not an error, we'll end up trying to invoke a command named 'param'. + // This is not an error, we'll end up trying to invoke a command named 'param'. return null; } @@ -929,9 +929,9 @@ namespace System.Management.Automation.Language private List ParameterListRule() { - //G parameter-list: - //G script-parameter - //G parameter-list new-lines:opt ',' script-parameter + // G parameter-list: + // G script-parameter + // G parameter-list new-lines:opt ',' script-parameter List parameters = new List(); Token commaToken = null; @@ -969,10 +969,10 @@ namespace System.Management.Automation.Language private ParameterAst ParameterRule() { - //G script-parameter: - //G new-lines:opt attribute-list:opt new-lines:opt variable script-parameter-default:opt - //G script-parameter-default: - //G new-lines:opt '=' new-lines:opt expression + // G script-parameter: + // G new-lines:opt attribute-list:opt new-lines:opt variable script-parameter-default:opt + // G script-parameter-default: + // G new-lines:opt '=' new-lines:opt expression List attributes; VariableToken variableToken; @@ -1042,9 +1042,9 @@ namespace System.Management.Automation.Language private List AttributeListRule(bool inExpressionMode) { - //G attribute-list: - //G attribute - //G attribute-list attribute + // G attribute-list: + // G attribute + // G attribute-list attribute List attributes = new List(); AttributeBaseAst attribute = AttributeRule(); @@ -1069,10 +1069,10 @@ namespace System.Management.Automation.Language private AttributeBaseAst AttributeRule() { - //G attribute: - //G '[' attribute-name '(' attribute-arguments ')' ']' - //G attribute-name: - //G type-spec + // G attribute: + // G '[' attribute-name '(' attribute-arguments ')' ']' + // G attribute-name: + // G type-spec var lBracket = NextLBracket(); if (lBracket == null) @@ -1172,12 +1172,12 @@ namespace System.Management.Automation.Language ICollection namedArguments, ref IScriptExtent lastItemExtent) { - //G attribute-arguments: - //G attribute-argument - //G attribute-argument new-lines:opt ',' attribute-arguments - //G attribute-argument: - //G new-lines:opt expression - //G new-lines:opt property-name '=' new-lines:opt expression + // G attribute-arguments: + // G attribute-argument + // G attribute-argument new-lines:opt ',' attribute-arguments + // G attribute-argument: + // G new-lines:opt expression + // G new-lines:opt property-name '=' new-lines:opt expression bool oldDisableCommaOperator = _disableCommaOperator; Token commaToken = null; @@ -1285,37 +1285,37 @@ namespace System.Management.Automation.Language private ITypeName TypeNameRule(bool allowAssemblyQualifiedNames, out Token firstTypeNameToken) { - //G type-spec: - //G array-type-name dimension:opt ']' - //G generic-type-name generic-type-arguments ']' - //G type-name - //G array-type-name: - //G type-name '[' - //G generic-type-name: - //G type-name '[' - //G dimension: - //G ',' - //G dimension ',' - //G generic-type-arguments: - //G type-spec - //G generic-type-arguments ',' type-spec - //G type-name: - //G namespace-type-name - //G namespace-type-name ',' assembly-name-spec - //G namespace-type-name: - //G nested-type-name - //G namespace-spec '.' nested-type-name - //G nested-type-name: - //G type-name-identifier - //G nested-type-name '+' type-name-identifier - //G namespace-spec: - //G type-name-identifier - //G type-name-identifier '.' type-name-identifier - //G type-name-identifier: - //G type-name-identifier-char - //G type-name-identifier type-name-identifier-char - //G type-name-identifier-char: - //G any letter, digit, '.', '`', or '_'. + // G type-spec: + // G array-type-name dimension:opt ']' + // G generic-type-name generic-type-arguments ']' + // G type-name + // G array-type-name: + // G type-name '[' + // G generic-type-name: + // G type-name '[' + // G dimension: + // G ',' + // G dimension ',' + // G generic-type-arguments: + // G type-spec + // G generic-type-arguments ',' type-spec + // G type-name: + // G namespace-type-name + // G namespace-type-name ',' assembly-name-spec + // G namespace-type-name: + // G nested-type-name + // G namespace-spec '.' nested-type-name + // G nested-type-name: + // G type-name-identifier + // G nested-type-name '+' type-name-identifier + // G namespace-spec: + // G type-name-identifier + // G type-name-identifier '.' type-name-identifier + // G type-name-identifier: + // G type-name-identifier-char + // G type-name-identifier type-name-identifier-char + // G type-name-identifier-char: + // G any letter, digit, '.', '`', or '_'. // The above grammar is specified by the CLR. We don't attempt to implement the above grammar precisely, e.g. // we would permit 'a+b.c'. The above grammar would disallow this. @@ -1665,9 +1665,9 @@ namespace System.Management.Automation.Language private ScriptBlockAst ScriptBlockBodyRule(Token lCurly, List usingStatements, ParamBlockAst paramBlockAst, bool isFilter, StatementAst predefinedStatementAst) { - //G script-block-body: - //G named-block-list - //G statement-list + // G script-block-body: + // G named-block-list + // G statement-list Token token = PeekToken(); @@ -1710,13 +1710,13 @@ namespace System.Management.Automation.Language private ScriptBlockAst NamedBlockListRule(Token lCurly, List usingStatements, ParamBlockAst paramBlockAst) { - //G named-block-list: - //G named-block - //G named-block-list named-block - //G named-block: - //G statement-terminators:opt block-name statement-block - //G block-name: one of - //G 'dynamicparam' 'begin' 'process' 'end' + // G named-block-list: + // G named-block + // G named-block-list named-block + // G named-block: + // G statement-terminators:opt block-name statement-block + // G block-name: one of + // G 'dynamicparam' 'begin' 'process' 'end' NamedBlockAst dynamicParamBlock = null; NamedBlockAst beginBlock = null; @@ -1833,8 +1833,8 @@ namespace System.Management.Automation.Language private StatementBlockAst StatementBlockRule() { - //G statement-block: - //G new-lines:opt '{' statement-list:opt new-lines:opt '}' + // G statement-block: + // G new-lines:opt '{' statement-list:opt new-lines:opt '}' SkipNewlines(); Token lCurly = NextToken(); @@ -1871,9 +1871,9 @@ namespace System.Management.Automation.Language private IScriptExtent StatementListRule(List statements, List traps) { - //G statement-list: - //G statement - //G statement-list statement + // G statement-list: + // G statement + // G statement-list statement StatementAst firstStatement = null; StatementAst lastStatement = null; @@ -1927,33 +1927,33 @@ namespace System.Management.Automation.Language /// A statement ast. Never returns null, always returns PipelineAst.EmptyPipeline if there was no statement. private StatementAst StatementRule() { - //G statement: - //G if-statement - //G label:opt labeled-statement - //G function-statement - //G flow-control-statement statement-terminator - //G trap-statement - //G try-statement - //G data-statement - //G pipeline statement-terminator - //G - //G labeled-statement: - //G switch-statement - //G foreach-statement - //G for-statement - //G while-statement - //G do-statement - //G - //G flow-control-statement: - //G 'break' label-expression:opt - //G 'continue' label-expression:opt - //G 'throw' pipeline:opt - //G 'return' pipeline:opt - //G 'exit' pipeline:opt - //G - //G statement-terminator: - //G ';' - //G new-line-character + // G statement: + // G if-statement + // G label:opt labeled-statement + // G function-statement + // G flow-control-statement statement-terminator + // G trap-statement + // G try-statement + // G data-statement + // G pipeline statement-terminator + // G + // G labeled-statement: + // G switch-statement + // G foreach-statement + // G for-statement + // G while-statement + // G do-statement + // G + // G flow-control-statement: + // G 'break' label-expression:opt + // G 'continue' label-expression:opt + // G 'throw' pipeline:opt + // G 'return' pipeline:opt + // G 'exit' pipeline:opt + // G + // G statement-terminator: + // G ';' + // G new-line-character RuntimeHelpers.EnsureSufficientExecutionStack(); int restorePoint = 0; @@ -2169,12 +2169,12 @@ namespace System.Management.Automation.Language private ExpressionAst LabelOrKeyRule() { - //G label-expression: - //G simple-name - //G unary-expression - //G key-expression: - //G simple-name - //G unary-expression + // G label-expression: + // G simple-name + // G unary-expression + // G key-expression: + // G simple-name + // G unary-expression var simpleName = SimpleNameRule(); if (simpleName != null) @@ -2213,8 +2213,8 @@ namespace System.Management.Automation.Language private BreakStatementAst BreakStatementRule(Token breakToken) { - //G flow-control-statement: - //G 'break' label-expression:opt + // G flow-control-statement: + // G 'break' label-expression:opt ExpressionAst labelExpr = LabelOrKeyRule(); IScriptExtent extent = (labelExpr != null) @@ -2226,8 +2226,8 @@ namespace System.Management.Automation.Language private ContinueStatementAst ContinueStatementRule(Token continueToken) { - //G flow-control-statement: - //G 'continue' label-expression:opt + // G flow-control-statement: + // G 'continue' label-expression:opt ExpressionAst labelExpr = LabelOrKeyRule(); IScriptExtent extent = (labelExpr != null) @@ -2239,8 +2239,8 @@ namespace System.Management.Automation.Language private ReturnStatementAst ReturnStatementRule(Token token) { - //G flow-control-statement: - //G 'return' pipeline:opt + // G flow-control-statement: + // G 'return' pipeline:opt PipelineBaseAst pipeline = PipelineRule(); IScriptExtent extent = (pipeline != null) @@ -2251,8 +2251,8 @@ namespace System.Management.Automation.Language private ExitStatementAst ExitStatementRule(Token token) { - //G flow-control-statement: - //G 'exit' pipeline:opt + // G flow-control-statement: + // G 'exit' pipeline:opt PipelineBaseAst pipeline = PipelineRule(); IScriptExtent extent = (pipeline != null) @@ -2263,8 +2263,8 @@ namespace System.Management.Automation.Language private ThrowStatementAst ThrowStatementRule(Token token) { - //G flow-control-statement: - //G 'throw' pipeline:opt + // G flow-control-statement: + // G 'throw' pipeline:opt PipelineBaseAst pipeline = PipelineRule(); IScriptExtent extent = (pipeline != null) @@ -2275,15 +2275,15 @@ namespace System.Management.Automation.Language private StatementAst LabeledStatementRule(LabelToken label) { - //G statement: - //G label:opt labeled-statement - //G - //G labeled-statement: - //G switch-statement - //G foreach-statement - //G for-statement - //G while-statement - //G do-statement + // G statement: + // G label:opt labeled-statement + // G + // G labeled-statement: + // G switch-statement + // G foreach-statement + // G for-statement + // G while-statement + // G do-statement StatementAst statement; Token token = NextToken(); @@ -2316,8 +2316,8 @@ namespace System.Management.Automation.Language private StatementAst BlockStatementRule(Token kindToken) { - //G block-statement - //G keyword statement-block + // G block-statement + // G keyword statement-block StatementBlockAst body = StatementBlockRule(); @@ -2345,8 +2345,8 @@ namespace System.Management.Automation.Language /// private bool InlineScriptRule(Token inlineScriptToken, List elements) { - //G Command - //G InlineScript scriptblock-expression + // G Command + // G InlineScript scriptblock-expression Diagnostics.Assert(elements != null && elements.Count == 0, "The CommandElement list should be empty"); var commandName = new StringConstantExpressionAst(inlineScriptToken.Extent, inlineScriptToken.Text, StringConstantType.BareWord); @@ -2375,15 +2375,15 @@ namespace System.Management.Automation.Language private StatementAst IfStatementRule(Token ifToken) { - //G if-statement: - //G 'if' new-lines:opt '(' pipeline-statement ')' statement-block elseif-clauses:opt else-clause:opt - //G elseif-clauses: - //G elseif-clause - //G elseif-clauses elseif-clause - //G elseif-clause: - //G 'elseif' new-lines:opt '(' pipeline-statement ')' statement-block - //G else-clause: - //G 'else' statement-block + // G if-statement: + // G 'if' new-lines:opt '(' pipeline-statement ')' statement-block elseif-clauses:opt else-clause:opt + // G elseif-clauses: + // G elseif-clause + // G elseif-clauses elseif-clause + // G elseif-clause: + // G 'elseif' new-lines:opt '(' pipeline-statement ')' statement-block + // G else-clause: + // G 'else' statement-block List clauses = new List(); List componentAsts = new List(); @@ -2517,33 +2517,33 @@ namespace System.Management.Automation.Language private StatementAst SwitchStatementRule(LabelToken labelToken, Token switchToken) { - //G switch-statement: - //G 'switch' new-lines:opt switch-parameters:opt switch-condition switch-body - //G switch-parameters: - //G switch-parameter - //G switch-parameters switch-parameter - //G switch-parameter: - //G '-regex' - //G '-wildcard' - //G '-exact' - //G '-casesensitive' - //G '-parallel' - //G switch-condition: - //G '(' new-lines:opt pipeline new-lines:opt ')' - //G -file new-lines:opt switch-filename - //G switch-filename: - //G command-argument - //G primary-expression - //G switch-body: - //G new-lines:opt '{' new-lines:opt switch-clauses '}' - //G switch-clauses: - //G switch-clause - //G switch-clauses switch-clause - //G switch-clause: - //G switch-clause-condition statement-block statement-terminators:opt - //G switch-clause-condition: - //G command-argument - //G primary-expression + // G switch-statement: + // G 'switch' new-lines:opt switch-parameters:opt switch-condition switch-body + // G switch-parameters: + // G switch-parameter + // G switch-parameters switch-parameter + // G switch-parameter: + // G '-regex' + // G '-wildcard' + // G '-exact' + // G '-casesensitive' + // G '-parallel' + // G switch-condition: + // G '(' new-lines:opt pipeline new-lines:opt ')' + // G -file new-lines:opt switch-filename + // G switch-filename: + // G command-argument + // G primary-expression + // G switch-body: + // G new-lines:opt '{' new-lines:opt switch-clauses '}' + // G switch-clauses: + // G switch-clause + // G switch-clauses switch-clause + // G switch-clause: + // G switch-clause-condition statement-block statement-terminators:opt + // G switch-clause-condition: + // G command-argument + // G primary-expression IScriptExtent startExtent = (labelToken ?? switchToken).Extent; IScriptExtent endErrorStatement = startExtent; @@ -2857,11 +2857,11 @@ namespace System.Management.Automation.Language private StatementAst ConfigurationStatementRule(IEnumerable customAttributes, Token configurationToken) { - //G configuration-statement: - //G 'configuration' new-lines:opt singleNameExpression new-lines:opt statement-block - //G singleNameExpression: - //G command-argument - //G primary-expression + // G configuration-statement: + // G 'configuration' new-lines:opt singleNameExpression new-lines:opt statement-block + // G singleNameExpression: + // G command-argument + // G primary-expression IScriptExtent startExtent = configurationToken.Extent; IScriptExtent endErrorStatement = startExtent; @@ -3288,19 +3288,19 @@ namespace System.Management.Automation.Language private StatementAst ForeachStatementRule(LabelToken labelToken, Token forEachToken) { - //G foreach-statement: - //G 'foreach' new-lines:opt foreach-parameters:opt new-lines:opt '(' - //G new-lines:opt variable new-lines:opt 'in' new-lines:opt pipeline - //G new-lines:opt ')' statement-block - //G foreach-parameters: - //G foreach-parameter - //G foreach-parameters foreach-parameter - //G foreach-parameter: - //G '-parallel' - //G '-throttlelimit' new-lines:opt foreach-throttlelimit - //G foreach-throttlelimit: - //G command-argument - //G primary-expression + // G foreach-statement: + // G 'foreach' new-lines:opt foreach-parameters:opt new-lines:opt '(' + // G new-lines:opt variable new-lines:opt 'in' new-lines:opt pipeline + // G new-lines:opt ')' statement-block + // G foreach-parameters: + // G foreach-parameter + // G foreach-parameters foreach-parameter + // G foreach-parameter: + // G '-parallel' + // G '-throttlelimit' new-lines:opt foreach-throttlelimit + // G foreach-throttlelimit: + // G command-argument + // G primary-expression IScriptExtent startOfStatement = labelToken != null ? labelToken.Extent : forEachToken.Extent; IScriptExtent endErrorStatement = null; @@ -3450,25 +3450,25 @@ namespace System.Management.Automation.Language private StatementAst ForStatementRule(LabelToken labelToken, Token forToken) { - //G for-statement: - //G 'for' new-lines:opt '(' - //G new-lines:opt for-initializer:opt statement-terminator - //G new-lines:opt for-condition:opt statement-terminator - //G new-lines:opt for-iterator:opt - //G new-lines:opt ')' statement-block - //G 'for' new-lines:opt '(' - //G new-lines:opt for-initializer:opt statement-terminator - //G new-lines:opt for-condition:opt - //G new-lines:opt ')' statement-block - //G 'for' new-lines:opt '(' - //G new-lines:opt for-initializer:opt - //G new-lines:opt ')' statement-block - //G for-initializer: - //G pipeline - //G for-condition: - //G pipeline - //G for-iterator: - //G pipeline + // G for-statement: + // G 'for' new-lines:opt '(' + // G new-lines:opt for-initializer:opt statement-terminator + // G new-lines:opt for-condition:opt statement-terminator + // G new-lines:opt for-iterator:opt + // G new-lines:opt ')' statement-block + // G 'for' new-lines:opt '(' + // G new-lines:opt for-initializer:opt statement-terminator + // G new-lines:opt for-condition:opt + // G new-lines:opt ')' statement-block + // G 'for' new-lines:opt '(' + // G new-lines:opt for-initializer:opt + // G new-lines:opt ')' statement-block + // G for-initializer: + // G pipeline + // G for-condition: + // G pipeline + // G for-iterator: + // G pipeline IScriptExtent endErrorStatement = null; SkipNewlines(); @@ -3561,8 +3561,8 @@ namespace System.Management.Automation.Language private StatementAst WhileStatementRule(LabelToken labelToken, Token whileToken) { - //G while-statement: - //G 'while ' new-lines:opt '(' new-lines:opt while-condition new-lines:opt ')' statement-block + // G while-statement: + // G 'while ' new-lines:opt '(' new-lines:opt while-condition new-lines:opt ')' statement-block SkipNewlines(); @@ -4032,12 +4032,12 @@ namespace System.Management.Automation.Language private StatementAst DoWhileStatementRule(LabelToken labelToken, Token doToken) { - //G do-statement: - //G 'do' statement-block new-lines:opt 'while' new-lines:opt '(' while-condition new-lines:opt ')' - //G 'do' statement-block new-lines:opt 'until' new-lines:opt '(' while-condition new-lines:opt ')' - //G - //G while-condition: - //G new-lines:opt pipeline + // G do-statement: + // G 'do' statement-block new-lines:opt 'while' new-lines:opt '(' while-condition new-lines:opt ')' + // G 'do' statement-block new-lines:opt 'until' new-lines:opt '(' while-condition new-lines:opt ')' + // G + // G while-condition: + // G new-lines:opt pipeline IScriptExtent startExtent = (labelToken ?? doToken).Extent; IScriptExtent endErrorStatement = null; @@ -4140,20 +4140,20 @@ namespace System.Management.Automation.Language private StatementAst ClassDefinitionRule(List customAttributes, Token classToken) { - //G class-statement: - //G attribute-list:opt 'class' new-lines:opt class-name new-lines:opt '{' class-member-list '}' - //G attribute-list:opt 'class' new-lines:opt class-name new-lines:opt ':' base-type-list '{' new-lines:opt class-member-list:opt '}' - //G - //G class-name: - //G simple-name - //G - //G base-type-list: - //G new-lines:opt type-name new-lines:opt - //G base-class-list ',' new-lines:opt type-name new-lines:opt - //G - //G class-member-list: - //G class-member new-lines:opt - //G class-member-list class-member + // G class-statement: + // G attribute-list:opt 'class' new-lines:opt class-name new-lines:opt '{' class-member-list '}' + // G attribute-list:opt 'class' new-lines:opt class-name new-lines:opt ':' base-type-list '{' new-lines:opt class-member-list:opt '}' + // G + // G class-name: + // G simple-name + // G + // G base-type-list: + // G new-lines:opt type-name new-lines:opt + // G base-class-list ',' new-lines:opt type-name new-lines:opt + // G + // G class-member-list: + // G class-member new-lines:opt + // G class-member-list class-member SkipNewlines(); Token classNameToken; @@ -4278,7 +4278,7 @@ namespace System.Management.Automation.Language { nestedAsts = new List(); } - //no need to report error since the error is reported in method StatementRule + // no need to report error since the error is reported in method StatementRule nestedAsts.AddRange(customAttributes.OfType()); nestedAsts.Add(classDefn); } @@ -4298,25 +4298,25 @@ namespace System.Management.Automation.Language private MemberAst ClassMemberRule(string className, out List astsOnError) { - //G class-member: - //G method-member - //G property-member - //G - //G method-member: - //G member-attribute-list:opt function-statement - //G - //G property-member: - //G member-attribute-list:opt variable - //G member-attribute-list:opt variable '=' expression - //G - //G member-attribute-list: - //G member-attribute - //G member-attribute-list member-attribute - //G - //G member-attribute: - //G attribute - //G 'static' - //G 'hidden' + // G class-member: + // G method-member + // G property-member + // G + // G method-member: + // G member-attribute-list:opt function-statement + // G + // G property-member: + // G member-attribute-list:opt variable + // G member-attribute-list:opt variable '=' expression + // G + // G member-attribute-list: + // G member-attribute + // G member-attribute-list member-attribute + // G + // G member-attribute: + // G attribute + // G 'static' + // G 'hidden' IScriptExtent startExtent = null; var attributeList = new List(); @@ -4617,15 +4617,15 @@ namespace System.Management.Automation.Language private StatementAst EnumDefinitionRule(List customAttributes, Token enumToken) { - //G enum-statement: - //G 'enum' new-lines:opt enum-name '{' enum-member-list '}' - //G - //G enum-name: - //G simple-name - //G - //G enum-member-list: - //G enum-member new-lines:opt - //G enum-member-list enum-member + // G enum-statement: + // G 'enum' new-lines:opt enum-name '{' enum-member-list '}' + // G + // G enum-name: + // G simple-name + // G + // G enum-member-list: + // G enum-member new-lines:opt + // G enum-member-list enum-member SkipNewlines(); var name = SimpleNameRule(); @@ -4678,7 +4678,7 @@ namespace System.Management.Automation.Language var enumDefn = new TypeDefinitionAst(extent, name.Value, customAttributes == null ? null : customAttributes.OfType(), members, TypeAttributes.Enum, null); if (customAttributes != null && customAttributes.OfType().Any()) { - //no need to report error since there is error reported in method StatementRule + // no need to report error since there is error reported in method StatementRule List nestedAsts = new List(); nestedAsts.AddRange(customAttributes.OfType()); nestedAsts.Add(enumDefn); @@ -4690,12 +4690,12 @@ namespace System.Management.Automation.Language private MemberAst EnumMemberRule() { - //G enum-member: - //G enum-member-name - //G enum-member-name '=' expression - //G - //G enum-member-name: - //G simple-name + // G enum-member: + // G enum-member-name + // G enum-member-name '=' expression + // G + // G enum-member-name: + // G simple-name const PropertyAttributes enumMemberAttributes = PropertyAttributes.Public | PropertyAttributes.Static | PropertyAttributes.Literal; @@ -4765,16 +4765,16 @@ namespace System.Management.Automation.Language private StatementAst UsingStatementRule(Token usingToken) { - //G using-statement: - //G 'using' 'namespace' identifier - //G 'using' 'namespace' identifier '=' identifier - //G 'using' 'module' identifier - //G 'using' 'module' identifier '=' identifier - //G 'using' 'module' hashtable - //G 'using' 'module' identifier '=' hashtable - //G 'using' 'type' identifier '=' identifier - //G 'using' 'assembly' identifier - //G 'using' 'command' identifier '=' identifier + // G using-statement: + // G 'using' 'namespace' identifier + // G 'using' 'namespace' identifier '=' identifier + // G 'using' 'module' identifier + // G 'using' 'module' identifier '=' identifier + // G 'using' 'module' hashtable + // G 'using' 'module' identifier '=' hashtable + // G 'using' 'type' identifier '=' identifier + // G 'using' 'assembly' identifier + // G 'using' 'command' identifier '=' identifier // in case of aliasing (=), first identifier is alias name, second identifier is alias value (the real name). @@ -5026,14 +5026,14 @@ namespace System.Management.Automation.Language private StatementAst MethodDeclarationRule(Token functionNameToken, string className, bool isStaticMethod) { - //G method-statement: - //G new-lines:opt function-name function-parameter-declaration base-ctor-call:opt '{' script-block '}' - //G - //G base-ctor-call: // can be present only if function-name == className - //G ':' new-lines:opt 'base' new-lines:opt parenthesized-expression new-lines:opt - //G - //G function-name: - //G command-argument + // G method-statement: + // G new-lines:opt function-name function-parameter-declaration base-ctor-call:opt '{' script-block '}' + // G + // G base-ctor-call: // can be present only if function-name == className + // G ':' new-lines:opt 'base' new-lines:opt parenthesized-expression new-lines:opt + // G + // G function-name: + // G command-argument var functionName = functionNameToken.Text; List parameters; @@ -5174,13 +5174,13 @@ namespace System.Management.Automation.Language private StatementAst FunctionDeclarationRule(Token functionToken) { - //G function-statement: - //G 'function' new-lines:opt function-name function-parameter-declaration:opt '{' script-block '}' - //G 'filter' new-lines:opt function-name function-parameter-declaration:opt '{' script-block '}' - //G 'workflow' new-lines:opt function-name function-parameter-declaration:opt '{' script-block '}' - //G - //G function-name: - //G command-argument + // G function-statement: + // G 'function' new-lines:opt function-name function-parameter-declaration:opt '{' script-block '}' + // G 'filter' new-lines:opt function-name function-parameter-declaration:opt '{' script-block '}' + // G 'workflow' new-lines:opt function-name function-parameter-declaration:opt '{' script-block '}' + // G + // G function-name: + // G command-argument SkipNewlines(); @@ -5273,8 +5273,8 @@ namespace System.Management.Automation.Language private List FunctionParameterDeclarationRule(out IScriptExtent endErrorStatement, out Token rParen) { - //G function-parameter-declaration: - //G new-lines:opt '(' parameter-list new-lines:opt ')' + // G function-parameter-declaration: + // G new-lines:opt '(' parameter-list new-lines:opt ')' List parameters = null; endErrorStatement = null; @@ -5307,8 +5307,8 @@ namespace System.Management.Automation.Language private StatementAst TrapStatementRule(Token trapToken) { - //G trap-statement: - //G 'trap' new-lines:opt type-literal:opt statement-block + // G trap-statement: + // G 'trap' new-lines:opt type-literal:opt statement-block var restorePoint = _tokenizer.GetRestorePoint(); SkipNewlines(); @@ -5352,11 +5352,11 @@ namespace System.Management.Automation.Language /// A catch clause, or null there is no catch or there was some error. private CatchClauseAst CatchBlockRule(ref IScriptExtent endErrorStatement, ref List errorAsts) { - //G catch-clause: - //G new-lines:opt 'catch' catch-type-list:opt statement-block - //G catch-type-list: - //G new-lines:opt type-literal - //G catch-type-list new-lines:opt ',' new-lines:opt type-literal + // G catch-clause: + // G new-lines:opt 'catch' catch-type-list:opt statement-block + // G catch-type-list: + // G new-lines:opt type-literal + // G catch-type-list new-lines:opt ',' new-lines:opt type-literal SkipNewlines(); Token catchToken = NextToken(); @@ -5454,20 +5454,20 @@ namespace System.Management.Automation.Language private StatementAst TryStatementRule(Token tryToken) { - //G try-statement: - //G 'try' statement-block catch-clauses - //G 'try' statement-block finally-clause - //G 'try' statement-block catch-clauses finally-clause - //G catch-clauses: - //G catch-clause - //G catch-clauses catch-clause - //G catch-clause: - //G new-lines:opt 'catch' catch-type-list:opt statement-block - //G catch-type-list: - //G new-lines:opt type-literal - //G catch-type-list new-lines:opt ',' new-lines:opt type-literal - //G finally-clause: - //G new-lines:opt 'finally' statement-block + // G try-statement: + // G 'try' statement-block catch-clauses + // G 'try' statement-block finally-clause + // G 'try' statement-block catch-clauses finally-clause + // G catch-clauses: + // G catch-clause + // G catch-clauses catch-clause + // G catch-clause: + // G new-lines:opt 'catch' catch-type-list:opt statement-block + // G catch-type-list: + // G new-lines:opt type-literal + // G catch-type-list new-lines:opt ',' new-lines:opt type-literal + // G finally-clause: + // G new-lines:opt 'finally' statement-block SkipNewlines(); @@ -5533,17 +5533,17 @@ namespace System.Management.Automation.Language private StatementAst DataStatementRule(Token dataToken) { - //G data-statement: - //G 'data' new-lines:opt data-name data-commands-allowed:opt statement-block - //G data-name: - //G simple-name - //G data-commands-allowed: - //G new-lines:opt '-supportedcommand' data-commands-list - //G data-commands-list: - //G new-lines:opt data-command - //G data-commands-list ',' new-lines:opt data-command - //G data-command: - //G command-name-expr + // G data-statement: + // G 'data' new-lines:opt data-name data-commands-allowed:opt statement-block + // G data-name: + // G simple-name + // G data-commands-allowed: + // G new-lines:opt '-supportedcommand' data-commands-list + // G data-commands-list: + // G new-lines:opt data-command + // G data-commands-list ',' new-lines:opt data-command + // G data-command: + // G command-name-expr IScriptExtent endErrorStatement = null; SkipNewlines(); @@ -5634,17 +5634,17 @@ namespace System.Management.Automation.Language private PipelineBaseAst PipelineRule() { - //G pipeline: - //G assignment-expression - //G expression redirections:opt pipeline-tail:opt - //G command pipeline-tail:opt - //G - //G assignment-expression: - //G expression assignment-operator statement - //G - //G pipeline-tail: - //G '|' new-lines:opt command - //G '|' new-lines:opt command pipeline-tail + // G pipeline: + // G assignment-expression + // G expression redirections:opt pipeline-tail:opt + // G command pipeline-tail:opt + // G + // G assignment-expression: + // G expression assignment-operator statement + // G + // G pipeline-tail: + // G '|' new-lines:opt command + // G '|' new-lines:opt command pipeline-tail var pipelineElements = new List(); IScriptExtent startExtent = null; @@ -5827,15 +5827,15 @@ namespace System.Management.Automation.Language private RedirectionAst RedirectionRule(RedirectionToken redirectionToken, RedirectionAst[] redirections, ref IScriptExtent extent) { - //G redirections: - //G redirection - //G redirections redirection - //G redirection: - //G merging-redirection-operator - //G file-redirection-operator redirected-file-name - //G redirected-file-name: - //G command-argument - //G primary-expression + // G redirections: + // G redirection + // G redirections redirection + // G redirection: + // G merging-redirection-operator + // G file-redirection-operator redirected-file-name + // G redirected-file-name: + // G command-argument + // G primary-expression RedirectionAst result; @@ -6112,30 +6112,30 @@ namespace System.Management.Automation.Language internal Ast CommandRule(bool forDynamicKeyword) { - //G command: - //G command-name command-elements:opt - //G command-invocation-operator command-module:opt command-name-expr command-elements:opt - //G command-invocation-operator: one of - //G '&' '.' - //G command-module: - //G primary-expression - //G command-name: - //G generic-token - //G generic-token-with-subexpr - //G generic-token-with-subexpr: No whitespace is allowed between ) and command-name. - //G generic-token-with-subexpr-start statement-list:opt ) command-name - //G command-name-expr: - //G command-name - //G primary-expression - //G command-elements: - //G command-element - //G command-elements command-element - //G command-element: - //G command-parameter - //G command-argument - //G redirection - //G command-argument: - //G command-name-expr + // G command: + // G command-name command-elements:opt + // G command-invocation-operator command-module:opt command-name-expr command-elements:opt + // G command-invocation-operator: one of + // G '&' '.' + // G command-module: + // G primary-expression + // G command-name: + // G generic-token + // G generic-token-with-subexpr + // G generic-token-with-subexpr: No whitespace is allowed between ) and command-name. + // G generic-token-with-subexpr-start statement-list:opt ) command-name + // G command-name-expr: + // G command-name + // G primary-expression + // G command-elements: + // G command-element + // G command-elements command-element + // G command-element: + // G command-parameter + // G command-argument + // G redirection + // G command-argument: + // G command-name-expr Token firstToken; bool dotSource, ampersand; @@ -6361,43 +6361,43 @@ namespace System.Management.Automation.Language private ExpressionAst ExpressionRule() { - //G expression: - //G logical-expression - //G - //G logical-expression: - //G bitwise-expression - //G logical-expression '-and' new-lines:opt bitwise-expression - //G logical-expression '-or' new-lines:opt bitwise-expression - //G logical-expression '-xor' new-lines:opt bitwise-expression - //G - //G bitwise-expression: - //G comparison-expression - //G bitwise-expression '-band' new-lines:opt comparison-expression - //G bitwise-expression '-bor' new-lines:opt comparison-expression - //G bitwise-expression '-bxor' new-lines:opt comparison-expression - //G - //G comparison-expression: - //G additive-expression - //G comparison-expression comparison-operator new-lines:opt additive-expression - //G - //G additive-expression: - //G multiplicative-expression - //G additive-expression '+' new-lines:opt multiplicative-expression - //G additive-expression dash new-lines:opt multiplicative-expression - //G - //G multiplicative-expression: - //G format-expression - //G multiplicative-expression '*' new-lines:opt format-expression - //G multiplicative-expression '/' new-lines:opt format-expression - //G multiplicative-expression '%' new-lines:opt format-expression - //G - //G format-expression: - //G range-expression - //G format-expression format-operator new-lines:opt range-expression - //G - //G range-expression: - //G array-literal-expression - //G range-expression '..' new-lines:opt array-literal-expression + // G expression: + // G logical-expression + // G + // G logical-expression: + // G bitwise-expression + // G logical-expression '-and' new-lines:opt bitwise-expression + // G logical-expression '-or' new-lines:opt bitwise-expression + // G logical-expression '-xor' new-lines:opt bitwise-expression + // G + // G bitwise-expression: + // G comparison-expression + // G bitwise-expression '-band' new-lines:opt comparison-expression + // G bitwise-expression '-bor' new-lines:opt comparison-expression + // G bitwise-expression '-bxor' new-lines:opt comparison-expression + // G + // G comparison-expression: + // G additive-expression + // G comparison-expression comparison-operator new-lines:opt additive-expression + // G + // G additive-expression: + // G multiplicative-expression + // G additive-expression '+' new-lines:opt multiplicative-expression + // G additive-expression dash new-lines:opt multiplicative-expression + // G + // G multiplicative-expression: + // G format-expression + // G multiplicative-expression '*' new-lines:opt format-expression + // G multiplicative-expression '/' new-lines:opt format-expression + // G multiplicative-expression '%' new-lines:opt format-expression + // G + // G format-expression: + // G range-expression + // G format-expression format-operator new-lines:opt range-expression + // G + // G range-expression: + // G array-literal-expression + // G range-expression '..' new-lines:opt array-literal-expression RuntimeHelpers.EnsureSufficientExecutionStack(); var oldTokenizerMode = _tokenizer.Mode; try @@ -6522,9 +6522,9 @@ namespace System.Management.Automation.Language private ExpressionAst ArrayLiteralRule() { - //G array-literal-expression: - //G unary-expression - //G unary-expression ',' new-lines:opt array-literal-expression + // G array-literal-expression: + // G unary-expression + // G unary-expression ',' new-lines:opt array-literal-expression ExpressionAst lastExpr = UnaryExpressionRule(); ExpressionAst firstExpr = lastExpr; @@ -6566,31 +6566,31 @@ namespace System.Management.Automation.Language private ExpressionAst UnaryExpressionRule() { - //G unary-expression: - //G primary-expression - //G expression-with-unary-operator - //G - //G expression-with-unary-operator: - //G ',' new-lines:opt unary-expression - //G '-not' new-lines:opt unary-expression - //G '!' new-lines:opt unary-expression - //G '-bnot' new-lines:opt unary-expression - //G '+' new-lines:opt unary-expression - //G dash new-lines:opt unary-expression - //G pre-increment-expression - //G pre-decrement-expression - //G cast-expression - //G '-split' new-lines:opt unary-expression - //G '-join' new-lines:opt unary-expression - //G - //G pre-increment-expression: - //G '++' new-lines:opt unary-expression - //G - //G pre-decrement-expression: - //G dashdash new-lines:opt unary-expression - //G - //G cast-expression: - //G type-literal unary-expression + // G unary-expression: + // G primary-expression + // G expression-with-unary-operator + // G + // G expression-with-unary-operator: + // G ',' new-lines:opt unary-expression + // G '-not' new-lines:opt unary-expression + // G '!' new-lines:opt unary-expression + // G '-bnot' new-lines:opt unary-expression + // G '+' new-lines:opt unary-expression + // G dash new-lines:opt unary-expression + // G pre-increment-expression + // G pre-decrement-expression + // G cast-expression + // G '-split' new-lines:opt unary-expression + // G '-join' new-lines:opt unary-expression + // G + // G pre-increment-expression: + // G '++' new-lines:opt unary-expression + // G + // G pre-decrement-expression: + // G dashdash new-lines:opt unary-expression + // G + // G cast-expression: + // G type-literal unary-expression RuntimeHelpers.EnsureSufficientExecutionStack(); ExpressionAst expr = null; Token token; @@ -6741,22 +6741,22 @@ namespace System.Management.Automation.Language private ExpressionAst PrimaryExpressionRule(bool withMemberAccess) { - //G primary-expression: - //G value - //G member-access - //G element-access - //G invocation-expression - //G post-increment-expression - //G post-decrement-expression - //G value: - //G parenthesized-expression - //G sub-expression - //G array-expression - //G script-block-expression - //G hash-literal-expression - //G literal - //G type-literal - //G variable + // G primary-expression: + // G value + // G member-access + // G element-access + // G invocation-expression + // G post-increment-expression + // G post-decrement-expression + // G value: + // G parenthesized-expression + // G sub-expression + // G array-expression + // G script-block-expression + // G hash-literal-expression + // G literal + // G type-literal + // G variable ExpressionAst expr; Token token = NextToken(); @@ -6854,14 +6854,14 @@ namespace System.Management.Automation.Language private ExpressionAst HashExpressionRule(Token atCurlyToken, bool parsingSchemaElement) { - //G hash-literal-expression: - //G '@{' new-lines:opt hash-literal-body:opt new-lines:opt '}' - //G hash-literal-body: - //G hash-entry - //G hash-literal-body statement-terminators hash-entry - //G statement-terminators: - //G statement-terminator - //G statement-terminators statement-terminator + // G hash-literal-expression: + // G '@{' new-lines:opt hash-literal-body:opt new-lines:opt '}' + // G hash-literal-body: + // G hash-entry + // G hash-literal-body statement-terminators hash-entry + // G statement-terminators: + // G statement-terminator + // G statement-terminators statement-terminator SkipNewlines(); @@ -6918,8 +6918,8 @@ namespace System.Management.Automation.Language private KeyValuePair GetKeyValuePair(bool parsingSchemaElement) { - //G hash-entry: - //G key-expression '=' new-lines:opt statement + // G hash-entry: + // G key-expression '=' new-lines:opt statement Token equals; ExpressionAst key; @@ -7006,8 +7006,8 @@ namespace System.Management.Automation.Language private ExpressionAst ScriptBlockExpressionRule(Token lCurly) { - //G script-block-expression: - //G '{' new-lines:opt script-block new-lines:opt '}' + // G script-block-expression: + // G '{' new-lines:opt script-block new-lines:opt '}' ScriptBlockAst scriptBlockAst; @@ -7032,10 +7032,10 @@ namespace System.Management.Automation.Language private ExpressionAst SubExpressionRule(Token firstToken) { - //G array-expression: - //G '@(' new-lines:opt statement-list:opt new-lines:opt ')' - //G sub-expression: - //G '$(' new-lines:opt statement-list:opt new-lines:opt ')' + // G array-expression: + // G '@(' new-lines:opt statement-list:opt new-lines:opt ')' + // G sub-expression: + // G '$(' new-lines:opt statement-list:opt new-lines:opt ')' IScriptExtent statementListExtent; List traps = new List(); @@ -7086,8 +7086,8 @@ namespace System.Management.Automation.Language private ExpressionAst ParenthesizedExpressionRule(Token lParen) { - //G parenthesized-expression: - //G '(' new-lines:opt pipeline new-lines:opt ')' + // G parenthesized-expression: + // G '(' new-lines:opt pipeline new-lines:opt ')' Token rParen; PipelineBaseAst pipelineAst; @@ -7149,15 +7149,15 @@ namespace System.Management.Automation.Language } // Enable if we decide we still need to support // "${}" or "$var:" - //else if (token.Kind == TokenKind.Unknown) - //{ - // //Diagnostics.Assert(token.Text.Equals("${}", StringComparison.OrdinalIgnoreCase), + // else if (token.Kind == TokenKind.Unknown) + // { + // // Diagnostics.Assert(token.Text.Equals("${}", StringComparison.OrdinalIgnoreCase), // // "The unknown token is only used in an expandable string when it's an empty variable name."); // // TODO: Need strict-mode check at runtime. // // TODO: in V2, "${}" expanded to '$', but "$var:" expanded to the empty string // exprAst = new StringConstantExpressionAst(token.Extent, "$", StringConstantType.BareWord); // if (_savingTokens) { newNestedTokens.Add(token); } - //} + // } else { TokenizerState ts = null; @@ -7186,8 +7186,8 @@ namespace System.Management.Automation.Language private ExpressionAst ExpandableStringRule(StringExpandableToken strToken) { - //G value: - //G literal + // G value: + // G literal ExpressionAst expr; // We need to scan the nested tokens even if there was some error. This is used by the tab completion: "pshome is $psh @@ -7206,12 +7206,12 @@ namespace System.Management.Automation.Language private ExpressionAst MemberNameRule() { - //G member-name: - //G simple-name - //G string-literal - //G string-literal-with-subexpression - //G expression-with-unary-operator - //G value + // G member-name: + // G simple-name + // G string-literal + // G string-literal-with-subexpression + // G expression-with-unary-operator + // G value ExpressionAst simpleName = SimpleNameRule(); if (simpleName != null) @@ -7230,9 +7230,9 @@ namespace System.Management.Automation.Language private ExpressionAst MemberAccessRule(ExpressionAst targetExpr, Token operatorToken) { - //G member-access: No whitespace is allowed between terms in these productions. - //G primary-expression '.' member-name - //G primary-expression '::' member-name + // G member-access: No whitespace is allowed between terms in these productions. + // G primary-expression '.' member-name + // G primary-expression '::' member-name // On entry, we've verified that operatorToken is not preceded by whitespace. @@ -7267,11 +7267,11 @@ namespace System.Management.Automation.Language private ExpressionAst MemberInvokeRule(ExpressionAst targetExpr, Token lBracket, Token operatorToken, CommandElementAst member) { - //G invocation-expression: target-expression passed as a parameter. lBracket can be '(' or '{'. - //G target-expression member-name invoke-param-list - //G invoke-param-list: - //G '(' invoke-param-paren-list - //G script-block + // G invocation-expression: target-expression passed as a parameter. lBracket can be '(' or '{'. + // G target-expression member-name invoke-param-list + // G invoke-param-list: + // G '(' invoke-param-paren-list + // G script-block IScriptExtent lastExtent = null; @@ -7295,15 +7295,15 @@ namespace System.Management.Automation.Language private List InvokeParamParenListRule(Token lParen, out IScriptExtent lastExtent) { - //G argument-list: '(' is passed in lParen - //G argument-expression-list:opt new-lines:opt ')' - //G argument-expression-list: - //G argument-expression - //G argument-expression new-lines:opt ',' argument-expression-list - //G argument-expression: - //G See grammar for expression - the only difference is that an - //G array-literal-expression is not allowed - the comma is used - //G to separate argument-expressions. + // G argument-list: '(' is passed in lParen + // G argument-expression-list:opt new-lines:opt ')' + // G argument-expression-list: + // G argument-expression + // G argument-expression new-lines:opt ',' argument-expression-list + // G argument-expression: + // G See grammar for expression - the only difference is that an + // G array-literal-expression is not allowed - the comma is used + // G to separate argument-expressions. List arguments = new List(); Token comma = null; @@ -7376,8 +7376,8 @@ namespace System.Management.Automation.Language private ExpressionAst ElementAccessRule(ExpressionAst primaryExpression, Token lBracket) { - //G element-access: - //G primary-expression '[' new-lines:opt expression new-lines:opt ']' + // G element-access: + // G primary-expression '[' new-lines:opt expression new-lines:opt ']' SkipNewlines(); ExpressionAst indexExpr = ExpressionRule(); diff --git a/src/System.Management.Automation/engine/parser/SemanticChecks.cs b/src/System.Management.Automation/engine/parser/SemanticChecks.cs index cb9b231cda..347e303f0b 100644 --- a/src/System.Management.Automation/engine/parser/SemanticChecks.cs +++ b/src/System.Management.Automation/engine/parser/SemanticChecks.cs @@ -1615,7 +1615,7 @@ namespace System.Management.Automation.Language if (functionMemberAst.ReturnType != null) { // Return type is of the class we're defined in - //it must return the class type, or array of the class type. + // it must return the class type, or array of the class type. var arrayTypeName = functionMemberAst.ReturnType.TypeName as ArrayTypeName; var typeName = (arrayTypeName != null ? arrayTypeName.ElementType : functionMemberAst.ReturnType.TypeName) as @@ -1635,7 +1635,7 @@ namespace System.Management.Automation.Language ParserStrings.DscResourceInvalidGetMethod, ((TypeDefinitionAst)functionMemberAst.Parent).Name); } - //Set hasGet to true to stop look up; it may have invalid get + // Set hasGet to true to stop look up; it may have invalid get hasGet = true; return; } @@ -2324,7 +2324,7 @@ namespace System.Management.Automation.Language { // REVIEW: it should be OK to allow these, since the ast now would visit the nested expressions and catch the errors. // Not allowed since most variables are not allowed - //ReportError(expandableStringExpressionAst, () => ParserStrings.ExpandableStringNotSupportedInDataSection); + // ReportError(expandableStringExpressionAst, () => ParserStrings.ExpandableStringNotSupportedInDataSection); return AstVisitAction.Continue; } diff --git a/src/System.Management.Automation/engine/parser/ast.cs b/src/System.Management.Automation/engine/parser/ast.cs index fb6d7a01d1..7ac85f386a 100644 --- a/src/System.Management.Automation/engine/parser/ast.cs +++ b/src/System.Management.Automation/engine/parser/ast.cs @@ -6347,7 +6347,7 @@ namespace System.Management.Automation.Language /// internal PipelineAst GenerateSetItemPipelineAst() { - //************************** + // ************************** // Now construct the AST to call the function that will build the actual object. // This is composed of a call to command with the signature // function PSDesiredStateConfiguration\\Configuration @@ -6452,7 +6452,7 @@ namespace System.Management.Automation.Language #region "Construct Set-Item pipeline" - //************************** + // ************************** // Now construct the AST to call the set-item cmdlet that will create the function // it will do set-item -Path function:\ConfigurationNameExpr -Value funcBody diff --git a/src/System.Management.Automation/engine/parser/tokenizer.cs b/src/System.Management.Automation/engine/parser/tokenizer.cs index e8adbb06e1..fbbbce8892 100644 --- a/src/System.Management.Automation/engine/parser/tokenizer.cs +++ b/src/System.Management.Automation/engine/parser/tokenizer.cs @@ -2837,10 +2837,10 @@ namespace System.Management.Automation.Language { // Enable if we decide we still need to support // "${}" or "$var:" - //if (inStringExpandable) - //{ + // if (inStringExpandable) + // { // return NewToken(TokenKind.Unknown); - //} + // } ReportError(NewScriptExtent(_tokenStart, _currentIndex), nameof(ParserStrings.InvalidBracedVariableReference), @@ -3249,7 +3249,7 @@ namespace System.Management.Automation.Language // indeed, '$' is not commonly used in command names. // Make sure our token does not start with any of these characters. - //Contract.Requires(Contract.ForAll("{}()@#;,|&\r\n\t ", c1 => sb[0] != c1)); + // Contract.Requires(Contract.ForAll("{}()@#;,|&\r\n\t ", c1 => sb[0] != c1)); List nestedTokens = new List(); var formatSb = GetStringBuilder(); @@ -4199,26 +4199,26 @@ namespace System.Management.Automation.Language internal string GetAssemblyNameSpec() { - //G assembly-name-spec: - //G assembly-name - //G assembly-name ',' assembly-properties - //G assembly-name: - //G assembly-token - //G assembly-properties: - //G assembly-property - //G assembly-properties ',' assembly-property - //G assembly-property: - //G assembly-property-name '=' assembly-property-value - //G assembly-property-name: one of - //G 'Version' - //G 'PublicKey' - //G 'PublicKeyToken' - //G 'Culture' - //G 'Custom' - //G assembly-property: - //G assembly-token - //G assembly-token: - //G any sequence of characters not ending in whitespace, newlines, ',', '=', or ']'. + // G assembly-name-spec: + // G assembly-name + // G assembly-name ',' assembly-properties + // G assembly-name: + // G assembly-token + // G assembly-properties: + // G assembly-property + // G assembly-properties ',' assembly-property + // G assembly-property: + // G assembly-property-name '=' assembly-property-value + // G assembly-property-name: one of + // G 'Version' + // G 'PublicKey' + // G 'PublicKeyToken' + // G 'Culture' + // G 'Custom' + // G assembly-property: + // G assembly-token + // G assembly-token: + // G any sequence of characters not ending in whitespace, newlines, ',', '=', or ']'. // The above grammar is specified by the CLR (except assembly-token). We defer validation to the CLR, but // use the above grammar to collect the name of the assembly. diff --git a/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs b/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs index 11180a27cd..2d14882269 100644 --- a/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs +++ b/src/System.Management.Automation/engine/remoting/client/ClientRemotePowerShell.cs @@ -959,9 +959,9 @@ namespace System.Management.Automation.Runspaces.Internal { if (disposing) { - //inputstream.Dispose(); - //outputstream.Dispose(); - //errorstream.Dispose(); + // inputstream.Dispose(); + // outputstream.Dispose(); + // errorstream.Dispose(); } } #endregion IDisposable diff --git a/src/System.Management.Automation/engine/remoting/client/Job.cs b/src/System.Management.Automation/engine/remoting/client/Job.cs index 7437c12f07..2c4256ad76 100644 --- a/src/System.Management.Automation/engine/remoting/client/Job.cs +++ b/src/System.Management.Automation/engine/remoting/client/Job.cs @@ -523,7 +523,7 @@ namespace System.Management.Automation private string _name; private IList _childJobs; internal readonly object syncObject = new object(); // object used for synchronization - //ISSUE: Should Result be public property + // ISSUE: Should Result be public property private PSDataCollection _results = new PSDataCollection(); private bool _resultsOwner = true; private PSDataCollection _error = new PSDataCollection(); @@ -1425,8 +1425,8 @@ namespace System.Management.Automation } #pragma warning disable 56500 - //Exception raised in the eventhandler are not error in job. - //silently ignore them. + // Exception raised in the eventhandler are not error in job. + // silently ignore them. try { tracer.WriteMessage("Job", "SetJobState", Guid.Empty, this, "Invoking StateChanged event", null); @@ -1782,13 +1782,13 @@ namespace System.Management.Automation // Create child jobs for each object in the list foreach (ExecutionCmdletHelperComputerName helper in computerNameHelpers) { - //Create Child Job and Register for its StateChanged Event + // Create Child Job and Register for its StateChanged Event PSRemotingChildJob childJob = new PSRemotingChildJob(remoteCommand, helper, _throttleManager); childJob.StateChanged += new EventHandler(HandleChildJobStateChanged); childJob.JobUnblocked += new EventHandler(HandleJobUnblocked); - //Add this job to list of childjobs + // Add this job to list of childjobs ChildJobs.Add(childJob); } @@ -1817,13 +1817,13 @@ namespace System.Management.Automation { ExecutionCmdletHelperRunspace helper = (ExecutionCmdletHelperRunspace)runspaceHelpers[i]; - //Create Child Job object and Register for its state changed event + // Create Child Job object and Register for its state changed event PSRemotingChildJob job = new PSRemotingChildJob(remoteCommand, helper, _throttleManager); job.StateChanged += new EventHandler(HandleChildJobStateChanged); job.JobUnblocked += new EventHandler(HandleJobUnblocked); - //Add the child job to list of child jobs + // Add the child job to list of child jobs ChildJobs.Add(job); } @@ -1879,8 +1879,8 @@ namespace System.Management.Automation /// private void CommonInit(int throttleLimit, List helpers) { - //Since no results are produced by any streams. We should - //close all the streams + // Since no results are produced by any streams. We should + // close all the streams base.CloseAllStreams(); // set status to "in progress" @@ -2309,7 +2309,7 @@ namespace System.Management.Automation private bool _hideComputerName = true; - //ISSUE: Implement StatusMessage + // ISSUE: Implement StatusMessage /// /// Checks the status of remote command execution. /// @@ -2327,7 +2327,7 @@ namespace System.Management.Automation // { // if (finishedCount == ChildJobs.Count) // { - // //ISSUE: Change this code to look in to child jobs for exception + // // ISSUE: Change this code to look in to child jobs for exception // if (errors.Count > 0) // { // statusMessage = "LocalErrors"; @@ -2360,7 +2360,7 @@ namespace System.Management.Automation #region finish logic - //This variable is set to true if atleast one child job failed. + // This variable is set to true if atleast one child job failed. private bool _atleastOneChildJobFailed = false; // count of number of child jobs which have finished @@ -2422,7 +2422,7 @@ namespace System.Management.Automation } } - //Ignore state changes which are not resulting in state change to finished. + // Ignore state changes which are not resulting in state change to finished. if (!IsFinishedState(e.JobStateInfo.State)) { return; @@ -2430,7 +2430,7 @@ namespace System.Management.Automation if (e.JobStateInfo.State == JobState.Failed) { - //If any of the child job failed, we set status to failed + // If any of the child job failed, we set status to failed _atleastOneChildJobFailed = true; } @@ -2439,7 +2439,7 @@ namespace System.Management.Automation { _finishedChildJobsCount++; - //We are done + // We are done if (_finishedChildJobsCount + _disconnectedChildJobsCount == ChildJobs.Count) { @@ -2449,9 +2449,9 @@ namespace System.Management.Automation if (allChildJobsFinished) { - //if any child job failed, set status to failed - //If stop was called set, status to stopped - //else completed + // if any child job failed, set status to failed + // If stop was called set, status to stopped + // else completed if (_disconnectedChildJobsCount > 0) { SetJobState(JobState.Disconnected); @@ -2852,7 +2852,7 @@ namespace System.Management.Automation #region stop - //bool isStopCalled = false; + // bool isStopCalled = false; /// /// Stops the job. /// @@ -2894,7 +2894,7 @@ namespace System.Management.Automation { get { - //ISSUE implement this. + // ISSUE implement this. return string.Empty; } } @@ -3096,8 +3096,8 @@ namespace System.Management.Automation new RemotingErrorRecord(er, originInfo); errorRecord.PreserveInvocationInfoOnce = true; - //ISSUE: Add an Assert for ErrorRecord. - //Add to the PSRemotingChild jobs streams + // ISSUE: Add an Assert for ErrorRecord. + // Add to the PSRemotingChild jobs streams this.WriteError(errorRecord); } } @@ -3196,17 +3196,17 @@ namespace System.Management.Automation /// Not used in this method. private void HandleThrottleComplete(object sender, EventArgs eventArgs) { - //Question: Why do we register for HandleThrottleComplete when we have already - //registered for PipelineStateChangedEvent? - //Answer: Because ThrottleManager at a given time can have some pipelines which are - //still not started. If TM.Stop() is called, then it simply discards those pipelines and - //PipelineStateChangedEvent is not called for them. For such jobs, we depend on - //HandleThrottleComplete to mark the finish of job. + // Question: Why do we register for HandleThrottleComplete when we have already + // registered for PipelineStateChangedEvent? + // Answer: Because ThrottleManager at a given time can have some pipelines which are + // still not started. If TM.Stop() is called, then it simply discards those pipelines and + // PipelineStateChangedEvent is not called for them. For such jobs, we depend on + // HandleThrottleComplete to mark the finish of job. - //Question: So it is possible in some cases DoFinish can be called twice. - //Answer: Yes: One from PipelineStateChangedEvent and Another here. But - //DoFinish has logic to check if it has been already called and second call - //becomes noOp. + // Question: So it is possible in some cases DoFinish can be called twice. + // Answer: Yes: One from PipelineStateChangedEvent and Another here. But + // DoFinish has logic to check if it has been already called and second call + // becomes noOp. DoFinish(); } @@ -3217,13 +3217,13 @@ namespace System.Management.Automation /// Operation complete event args. protected virtual void HandleOperationComplete(object sender, OperationStateEventArgs stateEventArgs) { - //Question:Why are we registering for OperationComplete if we already - //registering for StateChangedEvent and ThrottleComplete event - //Answer:Because in case of computer, if Runspace.Open it self fails, - //no pipeline is created and no pipeline state changed event is raised. - //We can wait for throttle complete, but it is raised only when all the - //operations are completed and this means that status of job is not updated - //untill Operation Complete. + // Question:Why are we registering for OperationComplete if we already + // registering for StateChangedEvent and ThrottleComplete event + // Answer:Because in case of computer, if Runspace.Open it self fails, + // no pipeline is created and no pipeline state changed event is raised. + // We can wait for throttle complete, but it is raised only when all the + // operations are completed and this means that status of job is not updated + // untill Operation Complete. ExecutionCmdletHelper helper = sender as ExecutionCmdletHelper; Dbg.Assert(helper != null, "Sender of OperationComplete has to be ExecutionCmdletHelper"); @@ -3492,7 +3492,7 @@ namespace System.Management.Automation /// need to be aggregated protected void AggregateResultsFromHelper(ExecutionCmdletHelper helper) { - //Get the pipeline associated with this helper and register for appropriate events + // Get the pipeline associated with this helper and register for appropriate events Pipeline pipeline = helper.Pipeline; pipeline.Output.DataReady += new EventHandler(HandleOutputReady); pipeline.Error.DataReady += new EventHandler(HandleErrorReady); @@ -3716,7 +3716,7 @@ namespace System.Management.Automation protected void DeterminedAndSetJobState(ExecutionCmdletHelper helper) { Exception failureException; - //Process the reason in case of failure. + // Process the reason in case of failure. ProcessJobFailure(helper, out failureException, out _failureErrorRecord); if (failureException != null) @@ -3725,12 +3725,12 @@ namespace System.Management.Automation } else { - //Get the state of the pipeline + // Get the state of the pipeline PipelineState state = helper.Pipeline.PipelineStateInfo.State; if (state == PipelineState.NotStarted) { - //This is a case in which pipeline was not started and TM.Stop was - //called. See comment in HandleThrottleComplete + // This is a case in which pipeline was not started and TM.Stop was + // called. See comment in HandleThrottleComplete SetJobState(JobState.Stopped); } else if (state == PipelineState.Completed) @@ -3819,10 +3819,10 @@ namespace System.Management.Automation #region Private Members - //helper associated with this job object + // helper associated with this job object private RemotePipeline _remotePipeline = null; - //object used for synchronization + // object used for synchronization protected object SyncObject = new object(); private ThrottleManager _throttleManager; @@ -4169,7 +4169,7 @@ namespace System.Management.Automation } UnregisterThrottleComplete(_throttleManager); - //throttleManager = null; + // throttleManager = null; Results.DecrementRef(); } @@ -4195,7 +4195,7 @@ namespace System.Management.Automation Dbg.Assert(helper != null, "Sender of OperationComplete has to be ExecutionCmdletHelper"); Exception failureException; - //Process the reason in case of failure. + // Process the reason in case of failure. ErrorRecord failureErrorRecord; ProcessJobFailure(helper, out failureException, out failureErrorRecord); diff --git a/src/System.Management.Automation/engine/remoting/client/Job2.cs b/src/System.Management.Automation/engine/remoting/client/Job2.cs index 6f60c17761..f3bc810e4b 100644 --- a/src/System.Management.Automation/engine/remoting/client/Job2.cs +++ b/src/System.Management.Automation/engine/remoting/client/Job2.cs @@ -506,7 +506,7 @@ namespace System.Management.Automation private int _isDisposed = 0; private const int DisposedTrue = 1; private const int DisposedFalse = 0; - //This variable is set to true if atleast one child job failed. + // This variable is set to true if atleast one child job failed. // count of number of child jobs which have finished private int _finishedChildJobsCount = 0; @@ -1940,7 +1940,7 @@ namespace System.Management.Automation int finishedChildJobsCountNew = Interlocked.Increment(ref finishedChildJobsCount); - //We are done + // We are done if (finishedChildJobsCountNew == childJobsCount) { allChildJobsFinished = true; @@ -1948,9 +1948,9 @@ namespace System.Management.Automation if (allChildJobsFinished) { - //if any child job failed, set status to failed - //If stop was called set, status to stopped - //else completed); + // if any child job failed, set status to failed + // If stop was called set, status to stopped + // else completed); if (failedChildJobsCount > 0) { tracer.WriteMessage(traceClassName, ": JobState is failed, at least one child job failed."); diff --git a/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs b/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs index f0e4bf5210..85a215303c 100644 --- a/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs +++ b/src/System.Management.Automation/engine/remoting/client/RemoteRunspacePoolInternal.cs @@ -982,7 +982,7 @@ namespace System.Management.Automation.Runspaces.Internal if (!skipClosing) { - //SetRunspacePoolState(new RunspacePoolStateInfo(RunspacePoolState.Closing, null), true); + // SetRunspacePoolState(new RunspacePoolStateInfo(RunspacePoolState.Closing, null), true); // send a message using the data structure handler to close the RunspacePool // on the remote server diff --git a/src/System.Management.Automation/engine/remoting/client/RemotingProtocol2.cs b/src/System.Management.Automation/engine/remoting/client/RemotingProtocol2.cs index 0ccdfded33..4d36496f3c 100644 --- a/src/System.Management.Automation/engine/remoting/client/RemotingProtocol2.cs +++ b/src/System.Management.Automation/engine/remoting/client/RemotingProtocol2.cs @@ -40,7 +40,7 @@ namespace System.Management.Automation.Internal _host = clientRunspacePool.Host; _applicationArguments = clientRunspacePool.ApplicationArguments; RemoteSession = CreateClientRemoteSession(clientRunspacePool); - //TODO: Assign remote session name.. should be passed from clientRunspacePool + // TODO: Assign remote session name.. should be passed from clientRunspacePool _transportManager = RemoteSession.SessionDataStructureHandler.TransportManager; _transportManager.TypeTable = typeTable; RemoteSession.StateChanged += @@ -97,7 +97,7 @@ namespace System.Management.Automation.Internal /// internal void ReconnectPoolAsync() { - //TODO: Integrate this into state machine + // TODO: Integrate this into state machine _reconnecting = true; PrepareForConnect(); RemoteSession.ReconnectAsync(); @@ -493,8 +493,8 @@ namespace System.Management.Automation.Internal lock (_syncObject) { - //We are doing this check because Established event - //is raised more than once + // We are doing this check because Established event + // is raised more than once if (_createRunspaceCalled) { // TODO: Put an assert here. NegotiationSending cannot @@ -1083,7 +1083,7 @@ namespace System.Management.Automation.Internal private void HandleDelayStreamRequestProcessed(object sender, EventArgs e) { - //client's request to start pipeline in disconnected mode has been successfully processed + // client's request to start pipeline in disconnected mode has been successfully processed ProcessDisconnect(null); } @@ -1414,7 +1414,7 @@ namespace System.Management.Automation.Internal /// internal void ProcessDisconnect(RunspacePoolStateInfo rsStateInfo) { - //disconnect may be called on a pipeline that is already disconnected. + // disconnect may be called on a pipeline that is already disconnected. PSInvocationStateInfo stateInfo = new PSInvocationStateInfo(PSInvocationState.Disconnected, (rsStateInfo != null) ? rsStateInfo.Reason : null); @@ -1447,7 +1447,7 @@ namespace System.Management.Automation.Internal TransportManager.ReconnectAsync(); } - //Called from session DSHandler. Connects to a remote powershell instance. + // Called from session DSHandler. Connects to a remote powershell instance. internal void ConnectAsync() { int currentState = Interlocked.CompareExchange(ref _connectionState, (int)connectionStates.Connecting, (int)connectionStates.Disconnected); @@ -1570,7 +1570,7 @@ namespace System.Management.Automation.Internal if (!inputstream.IsOpen) { - //Write any data written after the NonBlockingRead call above. + // Write any data written after the NonBlockingRead call above. inputObjects = inputstream.ObjectReader.NonBlockingRead(Int32.MaxValue); foreach (object inputObject in inputObjects) diff --git a/src/System.Management.Automation/engine/remoting/client/clientremotesession.cs b/src/System.Management.Automation/engine/remoting/client/clientremotesession.cs index d6e5e1af4f..ea294145b7 100644 --- a/src/System.Management.Automation/engine/remoting/client/clientremotesession.cs +++ b/src/System.Management.Automation/engine/remoting/client/clientremotesession.cs @@ -210,7 +210,7 @@ namespace System.Management.Automation.Remoting "ShellUri", string.Empty); MySelf = RemotingDestination.Client; - //Create session data structure handler for this session + // Create session data structure handler for this session SessionDataStructureHandler = new ClientRemoteSessionDSHandlerImpl(this, _cryptoHelper, rsPool.ConnectionInfo, @@ -218,7 +218,7 @@ namespace System.Management.Automation.Remoting BaseSessionDataStructureHandler = SessionDataStructureHandler; _waitHandleForConfigurationReceived = new ManualResetEvent(false); - //Register handlers for various ClientSessiondata structure handler events + // Register handlers for various ClientSessiondata structure handler events SessionDataStructureHandler.NegotiationReceived += HandleNegotiationReceived; SessionDataStructureHandler.ConnectionStateChanged += HandleConnectionStateChanged; SessionDataStructureHandler.EncryptedSessionKeyReceived += @@ -236,7 +236,7 @@ namespace System.Management.Automation.Remoting /// public override void CreateAsync() { - //Raise a CreateSession event in StateMachine. This start the process of connection and negotiation to a new remote session + // Raise a CreateSession event in StateMachine. This start the process of connection and negotiation to a new remote session RemoteSessionStateMachineEventArgs startArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.CreateSession); SessionDataStructureHandler.StateMachine.RaiseEvent(startArg); } @@ -246,7 +246,7 @@ namespace System.Management.Automation.Remoting /// public override void ConnectAsync() { - //Raise the connectsession event in statemachine. This start the process of connection and negotiation to an existing remote session + // Raise the connectsession event in statemachine. This start the process of connection and negotiation to an existing remote session RemoteSessionStateMachineEventArgs startArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.ConnectSession); SessionDataStructureHandler.StateMachine.RaiseEvent(startArg); } @@ -302,7 +302,7 @@ namespace System.Management.Automation.Remoting throw PSTraceSource.NewArgumentNullException("arg"); } - if (arg.SessionStateInfo.State == RemoteSessionState.EstablishedAndKeyReceived) //TODO - Client session would never get into this state... to be removed + if (arg.SessionStateInfo.State == RemoteSessionState.EstablishedAndKeyReceived) // TODO - Client session would never get into this state... to be removed { // send the public key StartKeyExchange(); @@ -432,7 +432,7 @@ namespace System.Management.Automation.Remoting #endregion KeyExchange - //TODO:Review Configuration Story + // TODO:Review Configuration Story #region configuration private ManualResetEvent _waitHandleForConfigurationReceived; @@ -520,7 +520,7 @@ namespace System.Management.Automation.Remoting )) ) { - //passed negotiation check + // passed negotiation check } else { diff --git a/src/System.Management.Automation/engine/remoting/client/clientremotesessionprotocolstatemachine.cs b/src/System.Management.Automation/engine/remoting/client/clientremotesessionprotocolstatemachine.cs index c66c2cee9c..ba9470553a 100644 --- a/src/System.Management.Automation/engine/remoting/client/clientremotesessionprotocolstatemachine.cs +++ b/src/System.Management.Automation/engine/remoting/client/clientremotesessionprotocolstatemachine.cs @@ -262,7 +262,7 @@ namespace System.Management.Automation.Remoting if (_pendingDisconnect) { - //session key exchange is complete, if there is a disconnect pending, process it now + // session key exchange is complete, if there is a disconnect pending, process it now _pendingDisconnect = false; DoDisconnect(sender, eventArgs); } @@ -308,7 +308,7 @@ namespace System.Management.Automation.Remoting if (_state == RemoteSessionState.Disconnecting) { - SetState(RemoteSessionState.Disconnected, eventArgs.Reason); //set state to disconnected even TODO. Put some ETW event describing the disconnect process failure + SetState(RemoteSessionState.Disconnected, eventArgs.Reason); // set state to disconnected even TODO. Put some ETW event describing the disconnect process failure } } @@ -392,7 +392,7 @@ namespace System.Management.Automation.Remoting { _clientRemoteSessionStateChangeQueue = new Queue(); - //Initialize the state machine event handling matrix + // Initialize the state machine event handling matrix _stateMachineHandle = new EventHandler[(int)RemoteSessionState.MaxState, (int)RemoteSessionEvent.MaxEvent]; for (int i = 0; i < _stateMachineHandle.GetLength(0); i++) { @@ -431,7 +431,7 @@ namespace System.Management.Automation.Remoting _stateMachineHandle[(int)RemoteSessionState.Established, (int)RemoteSessionEvent.DisconnectStart] += DoDisconnect; _stateMachineHandle[(int)RemoteSessionState.Disconnecting, (int)RemoteSessionEvent.DisconnectCompleted] += SetStateHandler; - _stateMachineHandle[(int)RemoteSessionState.Disconnecting, (int)RemoteSessionEvent.DisconnectFailed] += SetStateHandler; //dont close + _stateMachineHandle[(int)RemoteSessionState.Disconnecting, (int)RemoteSessionEvent.DisconnectFailed] += SetStateHandler; // dont close _stateMachineHandle[(int)RemoteSessionState.Disconnected, (int)RemoteSessionEvent.ReconnectStart] += DoReconnect; _stateMachineHandle[(int)RemoteSessionState.Reconnecting, (int)RemoteSessionEvent.ReconnectCompleted] += SetStateHandler; _stateMachineHandle[(int)RemoteSessionState.Reconnecting, (int)RemoteSessionEvent.ReconnectFailed] += SetStateToClosedHandler; @@ -441,7 +441,7 @@ namespace System.Management.Automation.Remoting _stateMachineHandle[(int)RemoteSessionState.Established, (int)RemoteSessionEvent.RCDisconnectStarted] += DoRCDisconnectStarted; _stateMachineHandle[(int)RemoteSessionState.RCDisconnecting, (int)RemoteSessionEvent.DisconnectCompleted] += SetStateHandler; - //Disconnect during key exchange process + // Disconnect during key exchange process _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeySent, (int)RemoteSessionEvent.DisconnectStart] += DoDisconnectDuringKeyExchange; _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyRequested, (int)RemoteSessionEvent.DisconnectStart] += DoDisconnectDuringKeyExchange; @@ -453,7 +453,7 @@ namespace System.Management.Automation.Remoting _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeySent, (int)RemoteSessionEvent.KeyReceiveFailed] += SetStateToClosedHandler; // _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyRequested, (int)RemoteSessionEvent.KeySendFailed] += SetStateToClosedHandler; - //TODO: All these are potential unexpected state transitions.. should have a way to track these calls.. + // TODO: All these are potential unexpected state transitions.. should have a way to track these calls.. // should atleast put a dbg assert in this handler for (int i = 0; i < _stateMachineHandle.GetLength(0); i++) { @@ -640,8 +640,8 @@ namespace System.Management.Automation.Remoting if (State == RemoteSessionState.Idle) { - //We need to send negotiation and connect algorithm related info - //Change state to let other DSHandlers add appropriate messages to be piggybacked on transport's Create payload + // We need to send negotiation and connect algorithm related info + // Change state to let other DSHandlers add appropriate messages to be piggybacked on transport's Create payload RemoteSessionStateMachineEventArgs sendingArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.NegotiationSendingOnConnect); RaiseEvent(sendingArg); } @@ -678,7 +678,7 @@ namespace System.Management.Automation.Remoting private void DoDisconnectDuringKeyExchange(object sender, RemoteSessionStateMachineEventArgs arg) { - //set flag to indicate Disconnect request queue up + // set flag to indicate Disconnect request queue up _pendingDisconnect = true; } @@ -730,7 +730,7 @@ namespace System.Management.Automation.Remoting case RemoteSessionState.Connecting: case RemoteSessionState.Connected: case RemoteSessionState.Established: - case RemoteSessionState.EstablishedAndKeyReceived: //TODO - Client session would never get into this state... to be removed + case RemoteSessionState.EstablishedAndKeyReceived: // TODO - Client session would never get into this state... to be removed case RemoteSessionState.EstablishedAndKeySent: case RemoteSessionState.NegotiationReceived: case RemoteSessionState.NegotiationSent: diff --git a/src/System.Management.Automation/engine/remoting/client/remotepipeline.cs b/src/System.Management.Automation/engine/remoting/client/remotepipeline.cs index 4daf141c53..c40ef28d8b 100644 --- a/src/System.Management.Automation/engine/remoting/client/remotepipeline.cs +++ b/src/System.Management.Automation/engine/remoting/client/remotepipeline.cs @@ -77,7 +77,7 @@ namespace System.Management.Automation _computerName = ((RemoteRunspace)_runspace).ConnectionInfo.ComputerName; _runspaceId = _runspace.InstanceId; - //Initialize streams + // Initialize streams _inputCollection = new PSDataCollection(); _inputCollection.ReleaseOnEnumeration = true; @@ -93,13 +93,13 @@ namespace System.Management.Automation SetCommandCollection(_commands); - //Create event which will be signalled when pipeline execution - //is completed/failed/stoped. - //Note:Runspace.Close waits for all the running pipeline - //to finish. This Event must be created before pipeline is - //added to list of running pipelines. This avoids the race condition - //where Close is called after pipeline is added to list of - //running pipeline but before event is created. + // Create event which will be signalled when pipeline execution + // is completed/failed/stoped. + // Note:Runspace.Close waits for all the running pipeline + // to finish. This Event must be created before pipeline is + // added to list of running pipelines. This avoids the race condition + // where Close is called after pipeline is added to list of + // running pipeline but before event is created. PipelineFinishedEvent = new ManualResetEvent(false); } @@ -281,7 +281,7 @@ namespace System.Management.Automation { lock (_syncRoot) { - //Note:We do not return internal state. + // Note:We do not return internal state. return _pipelineStateInfo.Clone(); } } @@ -595,15 +595,15 @@ namespace System.Management.Automation returnResult = false; break; - //If pipeline execution has failed or completed or - //stoped, return silently. + // If pipeline execution has failed or completed or + // stoped, return silently. case PipelineState.Stopped: case PipelineState.Completed: case PipelineState.Failed: return false; - //If pipeline is in Stopping state, ignore the second - //stop. + // If pipeline is in Stopping state, ignore the second + // stop. case PipelineState.Stopping: isAlreadyStopping = true; return false; @@ -662,7 +662,7 @@ namespace System.Management.Automation // wait for the pipeline to stop..this will block // if the pipeline is already stopping. Stop(); - //_pipelineFinishedEvent.Close(); + // _pipelineFinishedEvent.Close(); if (_powershell != null) { @@ -770,12 +770,12 @@ namespace System.Management.Automation _pipelineStateInfo = new PipelineStateInfo(copyState, reason); copyStateInfo = _pipelineStateInfo; - //Add _pipelineStateInfo to _executionEventQueue. - //RaisePipelineStateEvents will raise event for each item - //in this queue. - //Note:We are doing clone here instead of passing the member - //_pipelineStateInfo because we donot want outside - //to change pipeline state. + // Add _pipelineStateInfo to _executionEventQueue. + // RaisePipelineStateEvents will raise event for each item + // in this queue. + // Note:We are doing clone here instead of passing the member + // _pipelineStateInfo because we donot want outside + // to change pipeline state. RunspaceAvailability previousAvailability = _runspace.RunspaceAvailability; Guid? cmdInstanceId = (_powershell != null) ? _powershell.InstanceId : (Guid?)null; @@ -822,9 +822,9 @@ namespace System.Management.Automation } else { - //Clear the events if there are no EventHandlers. This - //ensures that events do not get called for state - //changes prior to their registration. + // Clear the events if there are no EventHandlers. This + // ensures that events do not get called for state + // changes prior to their registration. _executionEventQueue.Clear(); } } @@ -840,8 +840,8 @@ namespace System.Management.Automation _runspace.RaiseAvailabilityChangedEvent(queueItem.NewRunspaceAvailability); } - //Exception raised in the eventhandler are not error in pipeline. - //silently ignore them. + // Exception raised in the eventhandler are not error in pipeline. + // silently ignore them. if (stateChanged != null) { try @@ -958,7 +958,7 @@ namespace System.Management.Automation /// private void Cleanup() { - //Close the output stream if it is not closed. + // Close the output stream if it is not closed. if (_outputStream.IsOpen) { try @@ -971,7 +971,7 @@ namespace System.Management.Automation } } - //Close the error stream if it is not closed. + // Close the error stream if it is not closed. if (_errorStream.IsOpen) { try @@ -984,7 +984,7 @@ namespace System.Management.Automation } } - //Close the input stream if it is not closed. + // Close the input stream if it is not closed. if (_inputStream.IsOpen) { try @@ -999,9 +999,9 @@ namespace System.Management.Automation try { - //Runspace object maintains a list of pipelines in execution. - //Remove this pipeline from the list. This method also calls the - //pipeline finished event. + // Runspace object maintains a list of pipelines in execution. + // Remove this pipeline from the list. This method also calls the + // pipeline finished event. ((RemoteRunspace)_runspace).RemoveFromRunningPipelineList(this); PipelineFinishedEvent.Set(); diff --git a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs index ebe3b376c6..292efa404e 100644 --- a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs +++ b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs @@ -269,7 +269,7 @@ namespace System.Management.Automation { lock (_syncRoot) { - //Do not return internal state. + // Do not return internal state. return _runspaceStateInfo.Clone(); } } @@ -673,7 +673,7 @@ namespace System.Management.Automation _eventManager = null; RunspacePool.Dispose(); - //_runspacePool = null; + // _runspacePool = null; } catch (InvalidRunspacePoolStateException e) { @@ -1148,9 +1148,9 @@ namespace System.Management.Automation throw e; } - //Add the pipeline to list of Executing pipeline. - //Note:_runningPipelines is always accessed with the lock so - //there is no need to create a synchronized version of list + // Add the pipeline to list of Executing pipeline. + // Note:_runningPipelines is always accessed with the lock so + // there is no need to create a synchronized version of list _runningPipelines.Add(pipeline); } } @@ -1172,9 +1172,9 @@ namespace System.Management.Automation Dbg.Assert(_runspaceStateInfo.State != RunspaceState.BeforeOpen, "Runspace should not be before open when pipeline is running"); - //Remove the pipeline to list of Executing pipeline. - //Note:_runningPipelines is always accessed with the lock so - //there is no need to create a synchronized version of list + // Remove the pipeline to list of Executing pipeline. + // Note:_runningPipelines is always accessed with the lock so + // there is no need to create a synchronized version of list _runningPipelines.Remove(pipeline); pipeline.PipelineFinishedEvent.Set(); } @@ -1189,7 +1189,7 @@ namespace System.Management.Automation /// a synchronous method call internal void DoConcurrentCheckAndAddToRunningPipelines(RemotePipeline pipeline, bool syncCall) { - //Concurrency check should be done under runspace lock + // Concurrency check should be done under runspace lock lock (_syncRoot) { if (_bSessionStateProxyCallInProgress == true) @@ -1197,10 +1197,10 @@ namespace System.Management.Automation throw PSTraceSource.NewInvalidOperationException(RunspaceStrings.NoPipelineWhenSessionStateProxyInProgress); } - //Delegate to pipeline to do check if it is fine to invoke if another - //pipeline is running. + // Delegate to pipeline to do check if it is fine to invoke if another + // pipeline is running. pipeline.DoConcurrentCheck(syncCall); - //Finally add to the list of running pipelines. + // Finally add to the list of running pipelines. AddToRunningPipelineList(pipeline); } } @@ -1373,7 +1373,7 @@ namespace System.Management.Automation { lock (_syncRoot) { - //Call fails if RunspaceState is not BeforeOpen. + // Call fails if RunspaceState is not BeforeOpen. if (_runspaceStateInfo.State != RunspaceState.BeforeOpen) { InvalidRunspaceStateException e = @@ -1414,12 +1414,12 @@ namespace System.Management.Automation { _runspaceStateInfo = new RunspaceStateInfo(state, reason); - //Add _runspaceStateInfo to _runspaceEventQueue. - //RaiseRunspaceStateEvents will raise event for each item - //in this queue. - //Note:We are doing clone here instead of passing the member - //_runspaceStateInfo because we donot want outside - //to change our runspace state. + // Add _runspaceStateInfo to _runspaceEventQueue. + // RaiseRunspaceStateEvents will raise event for each item + // in this queue. + // Note:We are doing clone here instead of passing the member + // _runspaceStateInfo because we donot want outside + // to change our runspace state. RunspaceAvailability previousAvailability = _runspaceAvailability; this.UpdateRunspaceAvailability(_runspaceStateInfo.State, false); @@ -1460,9 +1460,9 @@ namespace System.Management.Automation } else { - //Clear the events if there are no EventHandlers. This - //ensures that events do not get called for state - //changes prior to their registration. + // Clear the events if there are no EventHandlers. This + // ensures that events do not get called for state + // changes prior to their registration. _runspaceEventQueue.Clear(); } } @@ -1478,8 +1478,8 @@ namespace System.Management.Automation this.OnAvailabilityChanged(new RunspaceAvailabilityEventArgs(queueItem.NewRunspaceAvailability)); } - //Exception raised by events are not error condition for runspace - //object. + // Exception raised by events are not error condition for runspace + // object. if (stateChanged != null) { try @@ -1513,13 +1513,13 @@ namespace System.Management.Automation [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Finishof")] private bool WaitForFinishofPipelines() { - //Take a snapshot of list of active pipelines. - //Note:Before we enter to this CloseHelper routine - //CoreClose has already set the state of Runspace - //to closing. So no new pipelines can be executed on this - //runspace and so no new pipelines will be added to - //_runningPipelines. However we still need to lock because - //running pipelines can be removed from this. + // Take a snapshot of list of active pipelines. + // Note:Before we enter to this CloseHelper routine + // CoreClose has already set the state of Runspace + // to closing. So no new pipelines can be executed on this + // runspace and so no new pipelines will be added to + // _runningPipelines. However we still need to lock because + // running pipelines can be removed from this. RemotePipeline[] runningPipelines; lock (_syncRoot) diff --git a/src/System.Management.Automation/engine/remoting/client/remotingprotocol.cs b/src/System.Management.Automation/engine/remoting/client/remotingprotocol.cs index 587fa14488..6a64088630 100644 --- a/src/System.Management.Automation/engine/remoting/client/remotingprotocol.cs +++ b/src/System.Management.Automation/engine/remoting/client/remotingprotocol.cs @@ -42,7 +42,7 @@ namespace System.Management.Automation.Remoting bool noInput); // TODO: If this is not used, remove this. - //internal abstract event EventHandler DataReceived; + // internal abstract event EventHandler DataReceived; internal abstract event EventHandler> EncryptedSessionKeyReceived; diff --git a/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs b/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs index 24b9158a0a..03a2d7dfcd 100644 --- a/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs +++ b/src/System.Management.Automation/engine/remoting/client/remotingprotocolimplementation.cs @@ -70,7 +70,7 @@ namespace System.Management.Automation.Remoting _session = session; - //Create state machine + // Create state machine _stateMachine = new ClientRemoteSessionDSHandlerStateMachine(); _stateMachine.StateChanged += HandleStateChanged; @@ -133,8 +133,8 @@ namespace System.Management.Automation.Remoting private void HandleConnectComplete(object sender, EventArgs args) { - //No-OP. Once the negotiation messages are exchanged and the session gets into established state, - //it will take care of spawning the receive operation on the connected session + // No-OP. Once the negotiation messages are exchanged and the session gets into established state, + // it will take care of spawning the receive operation on the connected session // There is however a caveat. // A rouge remote server if it does not send the required negotiation data in the Connect Response, // then the state machine can never get into the established state and the runspace can never get into a opened state @@ -151,7 +151,7 @@ namespace System.Management.Automation.Remoting private void HandleDisconnectComplete(object sender, EventArgs args) { - //Set statemachine event + // Set statemachine event RemoteSessionStateMachineEventArgs disconnectCompletedArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.DisconnectCompleted); StateMachine.RaiseEvent(disconnectCompletedArg); } @@ -196,7 +196,7 @@ namespace System.Management.Automation.Remoting private void HandleReconnectComplete(object sender, EventArgs args) { - //Set statemachine event + // Set statemachine event RemoteSessionStateMachineEventArgs reconnectCompletedArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.ReconnectCompleted); StateMachine.RaiseEvent(reconnectCompletedArg); } @@ -242,7 +242,7 @@ namespace System.Management.Automation.Remoting // is prepared for a NegotiationReceived response. Otherwise a race condition can // occur when the transport NegotiationReceived arrives too soon, breaking the session. // This race condition was observed for OutOfProc transport when reusing the OutOfProc process. - //this will change StateMachine to NegotiationSent. + // this will change StateMachine to NegotiationSent. RemoteSessionStateMachineEventArgs negotiationSendCompletedArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.NegotiationSendCompleted); _stateMachine.RaiseEvent(negotiationSendCompletedArg); @@ -295,7 +295,7 @@ namespace System.Management.Automation.Remoting SendNegotiationAsync(arg.SessionStateInfo.State); } - //once session is established.. start receiving data (if not already done and only apples to wsmanclientsessionTM) + // once session is established.. start receiving data (if not already done and only apples to wsmanclientsessionTM) if (arg.SessionStateInfo.State == RemoteSessionState.Established) { WSManClientSessionTransportManager tm = _transportManager as WSManClientSessionTransportManager; @@ -313,13 +313,13 @@ namespace System.Management.Automation.Remoting CloseConnectionAsync(); } - //process disconnect + // process disconnect if (arg.SessionStateInfo.State == RemoteSessionState.Disconnecting) { DisconnectAsync(); } - //process reconnect + // process reconnect if (arg.SessionStateInfo.State == RemoteSessionState.Reconnecting) { ReconnectAsync(); @@ -335,7 +335,7 @@ namespace System.Management.Automation.Remoting RemoteSessionCapability clientCapability = _session.Context.ClientCapability; Dbg.Assert(clientCapability.RemotingDestination == RemotingDestination.Server, "Expected clientCapability.RemotingDestination == RemotingDestination.Server"); - //Encode and send the negotiation reply + // Encode and send the negotiation reply RemoteDataObject data = RemotingEncoder.GenerateClientSessionCapability( clientCapability, _session.RemoteRunspacePoolInternal.InstanceId); RemoteDataObject dataAsPSObject = RemoteDataObject.CreateFrom( @@ -561,20 +561,20 @@ namespace System.Management.Automation.Remoting { case RemotingTargetInterface.Session: { - //Messages for session can cause statemachine state to change. - //These messages are first processed by Sessiondata structure handler and depending - //on the type of message, appropriate event is raised in state machine + // Messages for session can cause statemachine state to change. + // These messages are first processed by Sessiondata structure handler and depending + // on the type of message, appropriate event is raised in state machine ProcessSessionMessages(dataArg); break; } case RemotingTargetInterface.RunspacePool: case RemotingTargetInterface.PowerShell: - //Non Session messages do not change the state of the statemachine. - //However instead of forwarding them to Runspace/pipeline here, an - //event is raised in state machine which verified that state is - //suitable for accepting these messages. if state is suitable statemachine - //will call DoMessageForwading which will forward the messages appropriately + // Non Session messages do not change the state of the statemachine. + // However instead of forwarding them to Runspace/pipeline here, an + // event is raised in state machine which verified that state is + // suitable for accepting these messages. if state is suitable statemachine + // will call DoMessageForwading which will forward the messages appropriately RemoteSessionStateMachineEventArgs msgRcvArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.MessageReceived, null); if (StateMachine.CanByPassRaiseEvent(msgRcvArg)) { diff --git a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs index ef7c55d24f..fc1eb50242 100644 --- a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs +++ b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs @@ -671,7 +671,7 @@ else try { File.Delete(tmpFileName); - //WriteWarning(tmpFileName); + // WriteWarning(tmpFileName); } catch (UnauthorizedAccessException uae) { @@ -729,7 +729,7 @@ else { try { - //Make sure the file is not read only + // Make sure the file is not read only destfile.Attributes = destfile.Attributes & ~(FileAttributes.ReadOnly | FileAttributes.Hidden); destfile.Delete(); } @@ -1232,7 +1232,7 @@ else if (sessionTypeOption != null) { - //TODO: This should probably be a terminating exception for Win8 + // TODO: This should probably be a terminating exception for Win8 string privateData = this.sessionTypeOption.ConstructPrivateData(); if (!string.IsNullOrEmpty(privateData)) { @@ -4742,7 +4742,7 @@ $_ | Disable-PSSessionConfiguration -force $args[0] -whatif:$args[1] -confirm:$a _shellsToDisable.Add(PSSessionConfigurationCommandUtilities.GetWinrmPluginShellName()); } - //WriteWarning(StringUtil.Format(RemotingErrorIdStrings.DcsWarningMessage)); + // WriteWarning(StringUtil.Format(RemotingErrorIdStrings.DcsWarningMessage)); WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.EcsScriptMessageV, disablePluginSbFormat)); // gather -WhatIf, -Confirm parameter data and pass it to the script block @@ -4807,7 +4807,7 @@ $_ | Disable-PSSessionConfiguration -force $args[0] -whatif:$args[1] -confirm:$a // To Escape } -- }} // To Escape " -- "" - //TODO: CLR4: Remove the logic for setting the MaxMemoryPerShellMB to 200 MB once IPMO->Get-Command->Get-Help memory usage issue is fixed. + // TODO: CLR4: Remove the logic for setting the MaxMemoryPerShellMB to 200 MB once IPMO->Get-Command->Get-Help memory usage issue is fixed. private const string enableRemotingSbFormat = @" Set-StrictMode -Version Latest diff --git a/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs b/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs index 6a08aa5b73..88137aa2d3 100644 --- a/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs +++ b/src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs @@ -95,9 +95,9 @@ namespace Microsoft.PowerShell.Commands if (string.Equals(computerName, ".", StringComparison.OrdinalIgnoreCase)) { - //tracer.WriteEvent(ref PSEventDescriptors.PS_EVENT_HOSTNAMERESOLVE); - //tracer.Dispose(); - //tracer.OperationalChannel.WriteVerbose(PSEventId.HostNameResolve, PSOpcode.Method, PSTask.CreateRunspace); + // tracer.WriteEvent(ref PSEventDescriptors.PS_EVENT_HOSTNAMERESOLVE); + // tracer.Dispose(); + // tracer.OperationalChannel.WriteVerbose(PSEventId.HostNameResolve, PSOpcode.Method, PSTask.CreateRunspace); return s_LOCALHOST; } else @@ -147,7 +147,7 @@ namespace Microsoft.PowerShell.Commands private static string s_LOCALHOST = "localhost"; - //private PSETWTracer tracer = PSETWTracer.GetETWTracer(PSKeyword.Cmdlets); + // private PSETWTracer tracer = PSETWTracer.GetETWTracer(PSKeyword.Cmdlets); #endregion Private Members @@ -440,7 +440,7 @@ namespace Microsoft.PowerShell.Commands #region Tracer - //PSETWTracer tracer = PSETWTracer.GetETWTracer(PSKeyword.Runspace); + // PSETWTracer tracer = PSETWTracer.GetETWTracer(PSKeyword.Runspace); #endregion Tracer @@ -984,7 +984,7 @@ namespace Microsoft.PowerShell.Commands ErrorCategory.InvalidArgument, Session)); } - //BUGBUG: The following is a bogus check + // BUGBUG: The following is a bogus check // Check if the number of PSSession objects specified is greater // than the maximum allowable range if (RemotingCommandUtil.ExceedMaximumAllowableRunspaces(Session)) @@ -1987,7 +1987,7 @@ namespace Microsoft.PowerShell.Commands /// protected ScriptBlock GetScriptBlockFromFile(string filePath, bool isLiteralPath) { - //Make sure filepath doesn't contain wildcards + // Make sure filepath doesn't contain wildcards if ((!isLiteralPath) && WildcardPattern.ContainsWildcardCharacters(filePath)) { throw new ArgumentException(PSRemotingErrorInvariants.FormatResourceString(RemotingErrorIdStrings.WildCardErrorFilePathParameter), "filePath"); @@ -1998,10 +1998,10 @@ namespace Microsoft.PowerShell.Commands throw new ArgumentException(PSRemotingErrorInvariants.FormatResourceString(RemotingErrorIdStrings.FilePathShouldPS1Extension), "filePath"); } - //Resolve file path + // Resolve file path string resolvedPath = PathResolver.ResolveProviderAndPath(filePath, isLiteralPath, this, false, RemotingErrorIdStrings.FilePathNotFromFileSystemProvider); - //read content of file + // read content of file ExternalScriptInfo scriptInfo = new ExternalScriptInfo(filePath, resolvedPath, this.Context); // Skip ShouldRun check for .psd1 files. @@ -3802,7 +3802,7 @@ namespace Microsoft.PowerShell.Commands { return results[0]; } - else //if (results.Count > 1) + else // if (results.Count > 1) { Exception e = PSTraceSource.NewNotSupportedException(); cmdlet.ThrowTerminatingError( diff --git a/src/System.Management.Automation/engine/remoting/commands/ReceiveJob.cs b/src/System.Management.Automation/engine/remoting/commands/ReceiveJob.cs index 1d8cddebc8..85f801e8ec 100644 --- a/src/System.Management.Automation/engine/remoting/commands/ReceiveJob.cs +++ b/src/System.Management.Automation/engine/remoting/commands/ReceiveJob.cs @@ -363,13 +363,13 @@ namespace Microsoft.PowerShell.Commands continue; } - //Runspace parameter is supported only on PSRemotingJob objects + // Runspace parameter is supported only on PSRemotingJob objects foreach (PSSession remoteRunspaceInfo in _remoteRunspaceInfos) { // get the required child jobs List childJobs = remoteJob.GetJobsForRunspace(remoteRunspaceInfo); jobsToWrite.AddRange(childJobs); - //WriteResultsForJobsInCollection(childJobs, false); + // WriteResultsForJobsInCollection(childJobs, false); } } @@ -405,7 +405,7 @@ namespace Microsoft.PowerShell.Commands // get the required child Job objects List childJobs = remoteJob.GetJobsForComputer(resolvedComputerName); jobsToWrite.AddRange(childJobs); - //WriteResultsForJobsInCollection(childJobs, false); + // WriteResultsForJobsInCollection(childJobs, false); } } @@ -417,7 +417,7 @@ namespace Microsoft.PowerShell.Commands { if (_locations == null) { - //WriteAll(); + // WriteAll(); jobsToWrite.AddRange(_jobs); checkForRecurse = true; } @@ -430,7 +430,7 @@ namespace Microsoft.PowerShell.Commands // get the required child Job objects List childJobs = job.GetJobsForLocation(location); jobsToWrite.AddRange(childJobs); - //WriteResultsForJobsInCollection(childJobs, false); + // WriteResultsForJobsInCollection(childJobs, false); } } } @@ -444,7 +444,7 @@ namespace Microsoft.PowerShell.Commands jobsToWrite.AddRange(jobs); checkForRecurse = true; - //WriteResultsForJobsInCollection(jobs, true); + // WriteResultsForJobsInCollection(jobs, true); } break; @@ -454,7 +454,7 @@ namespace Microsoft.PowerShell.Commands List jobs = FindJobsMatchingBySessionId(true, false, true, false); jobsToWrite.AddRange(jobs); checkForRecurse = true; - //WriteResultsForJobsInCollection(jobs, true); + // WriteResultsForJobsInCollection(jobs, true); } break; @@ -464,7 +464,7 @@ namespace Microsoft.PowerShell.Commands List jobs = FindJobsMatchingByName(true, false, true, false); jobsToWrite.AddRange(jobs); checkForRecurse = true; - //WriteResultsForJobsInCollection(jobs, true); + // WriteResultsForJobsInCollection(jobs, true); } break; @@ -878,7 +878,7 @@ namespace Microsoft.PowerShell.Commands private void WriteReasonError(Job job) { - //Write better error for the remoting case and generic error for the other case + // Write better error for the remoting case and generic error for the other case PSRemotingChildJob child = job as PSRemotingChildJob; if (child != null && child.FailureErrorRecord != null) { @@ -947,7 +947,7 @@ namespace Microsoft.PowerShell.Commands /// private void WriteJobResultsRecursivelyHelper(Hashtable duplicate, Job job, bool registerInsteadOfWrite) { - //Check if this object is already visited. If not, add it to the cache + // Check if this object is already visited. If not, add it to the cache if (duplicate.ContainsKey(job)) { return; @@ -955,7 +955,7 @@ namespace Microsoft.PowerShell.Commands duplicate.Add(job, job); - //Write the results of child jobs + // Write the results of child jobs IList childJobs = job.ChildJobs; foreach (Job childjob in childJobs) @@ -976,7 +976,7 @@ namespace Microsoft.PowerShell.Commands } else { - //Write the results of this job + // Write the results of this job WriteJobResults(job); WriteJobStateInformationIfRequired(job); } diff --git a/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs b/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs index db886fa4e2..4d91227229 100644 --- a/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs +++ b/src/System.Management.Automation/engine/remoting/commands/RemoveJob.cs @@ -20,7 +20,7 @@ namespace Microsoft.PowerShell.Commands { #region Strings - //Parametersets used by job cmdlets + // Parametersets used by job cmdlets internal const string JobParameterSet = "JobParameterSet"; internal const string InstanceIdParameterSet = "InstanceIdParameterSet"; internal const string SessionIdParameterSet = "SessionIdParameterSet"; @@ -29,7 +29,7 @@ namespace Microsoft.PowerShell.Commands internal const string CommandParameterSet = "CommandParameterSet"; internal const string FilterParameterSet = "FilterParameterSet"; - //common parameter names + // common parameter names internal const string JobParameter = "Job"; internal const string InstanceIdParameter = "InstanceId"; internal const string SessionIdParameter = "SessionId"; @@ -141,7 +141,7 @@ namespace Microsoft.PowerShell.Commands // check if the job is available in any of the // top level jobs - //if (string.Equals(job.Name, name, StringComparison.OrdinalIgnoreCase)) + // if (string.Equals(job.Name, name, StringComparison.OrdinalIgnoreCase)) if (pattern.IsMatch(job.Name)) { jobFound = true; @@ -156,7 +156,7 @@ namespace Microsoft.PowerShell.Commands matches.Add(job); } } - //break; + // break; } // check if the job is available in any of the childjobs @@ -199,7 +199,7 @@ namespace Microsoft.PowerShell.Commands bool jobFound = FindJobsMatchingByInstanceIdHelper(matches, JobRepository.Jobs, id, duplicateDetector, recurse, writeobject, checkIfJobCanBeRemoved); - //TODO: optimize this to not search JobManager since matching by InstanceId is unique + // TODO: optimize this to not search JobManager since matching by InstanceId is unique // search all jobs in JobManager Job2 job2 = JobManager.GetJobByInstanceId(id, this, false, writeobject, recurse); @@ -886,7 +886,7 @@ namespace Microsoft.PowerShell.Commands break; } - //Now actually remove the jobs + // Now actually remove the jobs foreach (Job job in listOfJobsToRemove) { string message = GetMessage(RemotingErrorIdStrings.StopPSJobWhatIfTarget, diff --git a/src/System.Management.Automation/engine/remoting/commands/ResumeJob.cs b/src/System.Management.Automation/engine/remoting/commands/ResumeJob.cs index 7a0c4ce855..84bddf6439 100644 --- a/src/System.Management.Automation/engine/remoting/commands/ResumeJob.cs +++ b/src/System.Management.Automation/engine/remoting/commands/ResumeJob.cs @@ -76,7 +76,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ProcessRecord() { - //List of jobs to resume + // List of jobs to resume List jobsToResume = null; switch (ParameterSetName) diff --git a/src/System.Management.Automation/engine/remoting/commands/StopJob.cs b/src/System.Management.Automation/engine/remoting/commands/StopJob.cs index 79ae4b27bd..af8380e613 100644 --- a/src/System.Management.Automation/engine/remoting/commands/StopJob.cs +++ b/src/System.Management.Automation/engine/remoting/commands/StopJob.cs @@ -85,7 +85,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ProcessRecord() { - //List of jobs to stop + // List of jobs to stop List jobsToStop = null; switch (ParameterSetName) diff --git a/src/System.Management.Automation/engine/remoting/commands/SuspendJob.cs b/src/System.Management.Automation/engine/remoting/commands/SuspendJob.cs index 05c2492684..06015f2b13 100644 --- a/src/System.Management.Automation/engine/remoting/commands/SuspendJob.cs +++ b/src/System.Management.Automation/engine/remoting/commands/SuspendJob.cs @@ -112,7 +112,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ProcessRecord() { - //List of jobs to suspend + // List of jobs to suspend List jobsToSuspend = null; switch (ParameterSetName) diff --git a/src/System.Management.Automation/engine/remoting/commands/WaitJob.cs b/src/System.Management.Automation/engine/remoting/commands/WaitJob.cs index 2d9556fe35..4ec2461ffc 100644 --- a/src/System.Management.Automation/engine/remoting/commands/WaitJob.cs +++ b/src/System.Management.Automation/engine/remoting/commands/WaitJob.cs @@ -309,7 +309,7 @@ namespace Microsoft.PowerShell.Commands /// protected override void ProcessRecord() { - //List of jobs to wait + // List of jobs to wait List matches; switch (ParameterSetName) diff --git a/src/System.Management.Automation/engine/remoting/commands/remotingcommandutil.cs b/src/System.Management.Automation/engine/remoting/commands/remotingcommandutil.cs index 81d3893652..106552b5d5 100644 --- a/src/System.Management.Automation/engine/remoting/commands/remotingcommandutil.cs +++ b/src/System.Management.Automation/engine/remoting/commands/remotingcommandutil.cs @@ -158,7 +158,7 @@ namespace Microsoft.PowerShell.Commands if (isWinPEHost) { // WSMan is not supported on this platform - //throw new InvalidOperationException( + // throw new InvalidOperationException( // "WinPE does not support Windows PowerShell remoting"); ErrorRecord errorRecord = new ErrorRecord(new InvalidOperationException(StringUtil.Format(RemotingErrorIdStrings.WinPERemotingNotSupported)), null, ErrorCategory.InvalidOperation, null); throw new InvalidOperationException(errorRecord.ToString()); diff --git a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs index 0e70815c70..4b04f9a490 100644 --- a/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs +++ b/src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs @@ -485,7 +485,7 @@ namespace System.Management.Automation.Runspaces set { - //null or empty value allowed + // null or empty value allowed ConstructUri(_scheme, _computerName, null, value); } } @@ -890,7 +890,7 @@ namespace System.Management.Automation.Runspaces /// public WSManConnectionInfo() { - //ConstructUri(DefaultScheme, DefaultComputerName, DefaultPort, DefaultAppName); + // ConstructUri(DefaultScheme, DefaultComputerName, DefaultPort, DefaultAppName); UseDefaultWSManPort = true; } @@ -1186,7 +1186,7 @@ namespace System.Management.Automation.Runspaces throw e; } - //default host is localhost + // default host is localhost if (string.IsNullOrEmpty(computerName) || string.Equals(computerName, ".", StringComparison.OrdinalIgnoreCase)) { _computerName = DefaultComputerName; @@ -2384,7 +2384,7 @@ namespace System.Management.Automation.Runspaces { byte[] byteArr = System.Text.Encoding.UTF8.GetBytes(arr[i]); - arrPtr[i] = (byte*)Marshal.AllocHGlobal(byteArr.Length + 1); //+1 for null termination + arrPtr[i] = (byte*)Marshal.AllocHGlobal(byteArr.Length + 1); // +1 for null termination System.Diagnostics.Debug.Assert(arrPtr[i] != null, "Invalid array ptr"); Marshal.Copy(byteArr, 0, (IntPtr)arrPtr[i], byteArr.Length); // copy over the data from the managed byte array diff --git a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs index fded77de60..1c00bbbbaf 100644 --- a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs +++ b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs @@ -1198,17 +1198,17 @@ namespace System.Management.Automation // BUGBUG: This object creation needs to be relooked PSObject dataAsPSObject = CreateEmptyPSObject(); - //Add State Property + // Add State Property PSNoteProperty stateProperty = new PSNoteProperty(RemoteDataNameStrings.RunspaceState, (int)(stateInfo.State)); dataAsPSObject.Properties.Add(stateProperty); - //Add Reason property + // Add Reason property if (stateInfo.Reason != null) { - //If Reason is of not type IContainsErrorRecord, a new ErrorRecord is - //created using this errorId + // If Reason is of not type IContainsErrorRecord, a new ErrorRecord is + // created using this errorId string errorId = "RemoteRunspaceStateInfoReason"; PSNoteProperty exceptionProperty = GetExceptionProperty(stateInfo.Reason, errorId, ErrorCategory.NotSpecified); dataAsPSObject.Properties.Add(exceptionProperty); @@ -1515,15 +1515,15 @@ namespace System.Management.Automation internal static RemoteDataObject GeneratePowerShellStateInfo(PSInvocationStateInfo stateInfo, Guid clientPowerShellId, Guid clientRunspacePoolId) { - //Encode Pipeline StateInfo as PSObject + // Encode Pipeline StateInfo as PSObject PSObject dataAsPSObject = CreateEmptyPSObject(); - //Convert the state to int and add as property + // Convert the state to int and add as property PSNoteProperty stateProperty = new PSNoteProperty( RemoteDataNameStrings.PipelineState, (int)(stateInfo.State)); dataAsPSObject.Properties.Add(stateProperty); - //Add exception property + // Add exception property if (stateInfo.Reason != null) { // If Reason is of not type IContainsErrorRecord, @@ -1563,8 +1563,8 @@ namespace System.Management.Automation if (cer != null) { er = cer.ErrorRecord; - //Exception inside the error record is ParentContainsErrorRecordException which - //doesn't have stack trace. Replace it with top level exception. + // Exception inside the error record is ParentContainsErrorRecordException which + // doesn't have stack trace. Replace it with top level exception. er = new ErrorRecord(er, exception); } @@ -2050,13 +2050,13 @@ namespace System.Management.Automation /// private static Exception GetExceptionFromStateInfoObject(PSObject stateInfo) { - //Check if exception is encoded as errorrecord + // Check if exception is encoded as errorrecord PSPropertyInfo property = stateInfo.Properties[RemoteDataNameStrings.ExceptionAsErrorRecord]; if (property != null && property.Value != null) { return GetExceptionFromSerializedErrorRecord(property.Value); } - //Exception is not present and return null. + // Exception is not present and return null. return null; } diff --git a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteSessionCapability.cs b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteSessionCapability.cs index b89427977d..e31d1120a3 100644 --- a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteSessionCapability.cs +++ b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteSessionCapability.cs @@ -59,7 +59,7 @@ namespace System.Management.Automation.Remoting // PS Version 3 is fully backward compatible with Version 2 // In the remoting protocol sense, nothing is changing between PS3 and PS2 // For negotiation to succeed with old client/servers we have to use 2. - _psversion = new Version(2,0); //PSVersionInfo.PSVersion; + _psversion = new Version(2,0); // PSVersionInfo.PSVersion; _serversion = PSVersionInfo.SerializationVersion; _remotingDestination = remotingDestination; } diff --git a/src/System.Management.Automation/engine/remoting/common/misc.cs b/src/System.Management.Automation/engine/remoting/common/misc.cs index 3a36524b44..bec48c5ecb 100644 --- a/src/System.Management.Automation/engine/remoting/common/misc.cs +++ b/src/System.Management.Automation/engine/remoting/common/misc.cs @@ -87,7 +87,7 @@ namespace System.Management.Automation internal RemoteDataEventArgs(object data) { - //Dbg.Assert(data != null, "data passed should not be null"); + // Dbg.Assert(data != null, "data passed should not be null"); Data = (T)data; } diff --git a/src/System.Management.Automation/engine/remoting/fanin/BaseTransportManager.cs b/src/System.Management.Automation/engine/remoting/fanin/BaseTransportManager.cs index e1821a30f5..035fa4b373 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/BaseTransportManager.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/BaseTransportManager.cs @@ -428,7 +428,7 @@ namespace System.Management.Automation.Remoting.Client // this is used log crimson messages. - //keeps track of whether a receive request has been placed on transport + // keeps track of whether a receive request has been placed on transport protected bool receiveDataInitiated; #endregion diff --git a/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs b/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs index a043de1d9a..f91b7fb2a1 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/InitialSessionStateProvider.cs @@ -692,7 +692,7 @@ namespace System.Management.Automation.Remoting } else { - //Rooted path of dll is provided. + // Rooted path of dll is provided. assemblyPath = assemblyName; } diff --git a/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs b/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs index 3bd301b725..96e55c7c76 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/OutOfProcTransportManager.cs @@ -661,7 +661,7 @@ namespace System.Management.Automation.Remoting.Client private void OnCloseSessionCompleted() { - //stop timer + // stop timer _closeTimeOutTimer.Change(Timeout.Infinite, Timeout.Infinite); RaiseCloseCompleted(); CleanupConnection(); @@ -1034,7 +1034,7 @@ namespace System.Management.Automation.Remoting.Client } stdInWriter = _processInstance.StdInWriter; - //if (stdInWriter == null) + // if (stdInWriter == null) { _serverProcess.OutputDataReceived += new DataReceivedEventHandler(OnOutputDataReceived); _serverProcess.ErrorDataReceived += new DataReceivedEventHandler(OnErrorDataReceived); @@ -1042,7 +1042,7 @@ namespace System.Management.Automation.Remoting.Client _serverProcess.Exited += new EventHandler(OnExited); - //serverProcess.Start(); + // serverProcess.Start(); _processInstance.Start(); if (stdInWriter != null) @@ -2174,7 +2174,7 @@ namespace System.Management.Automation.Remoting.Client internal void OnSignalTimeOutTimerElapsed(object source) { - //Signal timer is triggered only once + // Signal timer is triggered only once if (isClosed) { @@ -2331,7 +2331,7 @@ namespace System.Management.Automation.Remoting.Server internal override void ReportExecutionStatusAsRunning() { - //No-OP for outofProc TMs + // No-OP for outofProc TMs } internal void CreateCommandTransportManager(Guid powerShellCmdId) @@ -2437,7 +2437,7 @@ namespace System.Management.Automation.Remoting.Server internal override void ReportExecutionStatusAsRunning() { - //No-OP for outofProc TMs + // No-OP for outofProc TMs } protected override void SendDataToClient(byte[] data, bool flush, bool reportAsPending, bool reportAsDataBoundary) diff --git a/src/System.Management.Automation/engine/remoting/fanin/PriorityCollection.cs b/src/System.Management.Automation/engine/remoting/fanin/PriorityCollection.cs index 7ed2cacc7a..e319a0a80e 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/PriorityCollection.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/PriorityCollection.cs @@ -574,7 +574,7 @@ namespace System.Management.Automation.Remoting if (sFlag) { - _canIgnoreOffSyncFragments = false; //reset this upon receiving a start fragment of a fresh object + _canIgnoreOffSyncFragments = false; // reset this upon receiving a start fragment of a fresh object _currentObjectId = objectId; // Memory streams created with an unsigned byte array provide a non-resizable stream view // of the data, and can only be written to. When using a byte array, you can neither append @@ -589,7 +589,7 @@ namespace System.Management.Automation.Remoting if (objectId != _currentObjectId) { s_baseTracer.WriteLine("ObjectId != CurrentObjectId"); - //TODO - drop an ETW event + // TODO - drop an ETW event ResetReceiveData(); if (!_canIgnoreOffSyncFragments) { @@ -606,7 +606,7 @@ namespace System.Management.Automation.Remoting if (fragmentId != (_currentFrgId + 1)) { s_baseTracer.WriteLine("Fragment Id is not in sequence."); - //TODO - drop an ETW event + // TODO - drop an ETW event ResetReceiveData(); if (!_canIgnoreOffSyncFragments) { diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs index 028b6fed04..87be6c6ed6 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs @@ -25,9 +25,9 @@ namespace System.Management.Automation.Remoting.Client internal const string CodePage = "WINRS_CODEPAGE"; internal static readonly Version WSMAN_STACK_VERSION = new Version(3, 0); internal const int WSMAN_FLAG_REQUESTED_API_VERSION_1_1 = 1; - //WSMan's default max env size in V2 + // WSMan's default max env size in V2 internal const int WSMAN_DEFAULT_MAX_ENVELOPE_SIZE_KB_V2 = 150; - //WSMan's default max env size in V3 + // WSMan's default max env size in V3 internal const int WSMAN_DEFAULT_MAX_ENVELOPE_SIZE_KB_V3 = 500; #region WSMan errors @@ -1931,7 +1931,7 @@ namespace System.Management.Automation.Remoting.Client WSManReceiveDataResultInternal result1 = Marshal.PtrToStructure(unmanagedData); - //copy data from unmanaged heap to managed heap. + // copy data from unmanaged heap to managed heap. byte[] dataRecvd = null; if (result1.data.binaryData.bufferLength > 0) { @@ -2037,7 +2037,7 @@ namespace System.Management.Automation.Remoting.Client /// internal static WSManPluginRequest UnMarshal(IntPtr unmanagedData) { - //Dbg.Assert(IntPtr.Zero != unmanagedData, "unmanagedData must be non-null. This means WinRM sent a bad pointer."); + // Dbg.Assert(IntPtr.Zero != unmanagedData, "unmanagedData must be non-null. This means WinRM sent a bad pointer."); WSManPluginRequest result = null; if (IntPtr.Zero != unmanagedData) @@ -2888,7 +2888,7 @@ namespace System.Management.Automation.Remoting.Client IntPtr requestDetails, int flags, [In, Out, MarshalAs(UnmanagedType.LPStruct)] WSManDataStruct data); - //[In, Out] ref IntPtr data); + // [In, Out] ref IntPtr data); /// /// Reports the completion of an operation by all operation entry points except for the diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs index e64b126460..61f6040cfc 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs @@ -369,7 +369,7 @@ namespace System.Management.Automation.Remoting bool isRegisterWaitForSingleObjectSucceeded = true; - //always synchronize calls to OperationComplete once notification handle is registered.. else duplicate OperationComplete calls are bound to happen + // always synchronize calls to OperationComplete once notification handle is registered.. else duplicate OperationComplete calls are bound to happen lock (mgdShellSession.shellSyncObject) { mgdShellSession.registeredShutdownNotification = 1; @@ -384,9 +384,9 @@ namespace System.Management.Automation.Remoting } else { - //On non-windows platforms the shutdown notification is done through a callback instead of a windows event handle. - //Register the callback and this will then signal the event. Note, the gch object is deleted in the shell shutdown - //notification that will always come in to shut down the operation. + // On non-windows platforms the shutdown notification is done through a callback instead of a windows event handle. + // Register the callback and this will then signal the event. Note, the gch object is deleted in the shell shutdown + // notification that will always come in to shut down the operation. GCHandle gch = GCHandle.Alloc(eventWaitHandle); IntPtr p = GCHandle.ToIntPtr(gch); @@ -438,7 +438,7 @@ namespace System.Management.Automation.Remoting bool ignore = mgdShellSession.registeredShutDownWaitHandle.Unregister(null); mgdShellSession.registeredShutDownWaitHandle = null; - //this will called OperationComplete + // this will called OperationComplete PerformCloseOperation(context); } @@ -466,7 +466,7 @@ namespace System.Management.Automation.Remoting if (mgdShellSession == null) { // this should never be the case. this will protect the service. - //Dbg.Assert(false, "context.shellContext not matched"); + // Dbg.Assert(false, "context.shellContext not matched"); return; } @@ -494,7 +494,7 @@ namespace System.Management.Automation.Remoting if (mgdShellSession == null) { // this should never be the case. this will protect the service. - //Dbg.Assert(false, "context.shellContext not matched"); + // Dbg.Assert(false, "context.shellContext not matched"); return; } @@ -757,9 +757,9 @@ namespace System.Management.Automation.Remoting return; } - //TODO... What does this mean from a new client that has specified diff locale from original client? + // TODO... What does this mean from a new client that has specified diff locale from original client? SetThreadProperties(requestDetails); - //TODO.. Add new ETW events and log + // TODO.. Add new ETW events and log /*etwTracer.AnalyticChannel.WriteInformation(PSEventId.ServerReceivedData, PSOpcode.Open, PSTask.None, ((IntPtr)shellContext).ToString(), ((IntPtr)commandContext).ToString(), ((IntPtr)requestDetails).ToString());*/ @@ -1471,22 +1471,22 @@ namespace System.Management.Automation.Remoting // requestDetails cannot not be null. Dbg.Assert(requestDetails != null, "requestDetails cannot be null"); - //IntPtr nativeLocaleData = IntPtr.Zero; + // IntPtr nativeLocaleData = IntPtr.Zero; WSManNativeApi.WSManDataStruct outputStruct = new WSManNativeApi.WSManDataStruct(); int hResult = wsmanPinvokeStatic.WSManPluginGetOperationParameters( requestDetails.unmanagedHandle, WSManPluginConstants.WSManPluginParamsGetRequestedLocale, outputStruct); - //ref nativeLocaleData); + // ref nativeLocaleData); bool retrievingLocaleSucceeded = (0 == hResult); WSManNativeApi.WSManData_UnToMan localeData = WSManNativeApi.WSManData_UnToMan.UnMarshal(outputStruct); // nativeLocaleData - //IntPtr nativeDataLocaleData = IntPtr.Zero; + // IntPtr nativeDataLocaleData = IntPtr.Zero; hResult = wsmanPinvokeStatic.WSManPluginGetOperationParameters( requestDetails.unmanagedHandle, WSManPluginConstants.WSManPluginParamsGetRequestedDataLocale, outputStruct); - //ref nativeDataLocaleData); + // ref nativeDataLocaleData); bool retrievingDataLocaleSucceeded = ((int)WSManPluginErrorCodes.NoError == hResult); WSManNativeApi.WSManData_UnToMan dataLocaleData = WSManNativeApi.WSManData_UnToMan.UnMarshal(outputStruct); // nativeDataLocaleData diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManPluginShellSession.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManPluginShellSession.cs index 7f91ccabc2..7acfe3afd1 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManPluginShellSession.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManPluginShellSession.cs @@ -97,7 +97,7 @@ namespace System.Management.Automation.Remoting if (disposing) { // Dispose managed resources. - //Close(false); + // Close(false); } // Call the appropriate methods to clean up @@ -254,7 +254,7 @@ namespace System.Management.Automation.Remoting PSKeyword.ManagedPlugin | PSKeyword.UseAlwaysAnalytic, creationRequestDetails.ToString(), creationRequestDetails.ToString()); - //RACE TO BE FIXED - As soon as this API is called, WinRM service will send CommandResponse back and Signal is expected anytime + // RACE TO BE FIXED - As soon as this API is called, WinRM service will send CommandResponse back and Signal is expected anytime // If Signal comes and executes before registering the notification handle, cleanup will be messed result = WSManNativeApi.WSManPluginReportContext(creationRequestDetails.unmanagedHandle, 0, creationRequestDetails.unmanagedHandle); if (Platform.IsWindows && (WSManPluginConstants.ExitCodeSuccess == result)) @@ -358,7 +358,7 @@ namespace System.Management.Automation.Remoting creationRequestDetails = null; // if already disposing..no need to let finalizer thread // put resources to clean this object. - //System.GC.SuppressFinalize(this); // TODO: This is already called in Dispose(). + // System.GC.SuppressFinalize(this); // TODO: This is already called in Dispose(). } // close current session and transport manager because of an exception @@ -454,7 +454,7 @@ namespace System.Management.Automation.Remoting return; } - //not registering shutdown event as this is a synchronous operation. + // not registering shutdown event as this is a synchronous operation. IntPtr responseXml = IntPtr.Zero; try @@ -467,20 +467,20 @@ namespace System.Management.Automation.Remoting inboundConnectInformation.Text, WSManNativeApi.PS_CONNECT_XML_TAG); - //this will raise exceptions on failure + // this will raise exceptions on failure try { _remoteSession.ExecuteConnect(inputData, out outputData); - //construct Xml to send back + // construct Xml to send back string responseData = string.Format(System.Globalization.CultureInfo.InvariantCulture, "<{0} xmlns=\"{1}\">{2}", WSManNativeApi.PS_CONNECTRESPONSE_XML_TAG, WSManNativeApi.PS_XML_NAMESPACE, Convert.ToBase64String(outputData)); - //TODO: currently using OperationComplete to report back the responseXml. This will need to change to use WSManReportObject - //that is currently internal. + // TODO: currently using OperationComplete to report back the responseXml. This will need to change to use WSManReportObject + // that is currently internal. WSManPluginInstance.ReportOperationComplete(requestDetails, WSManPluginErrorCodes.NoError, responseData); } catch (PSRemotingDataStructureException ex) diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManPluginTransportManager.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManPluginTransportManager.cs index f26534dd01..31277c5c9f 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManPluginTransportManager.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManPluginTransportManager.cs @@ -164,7 +164,7 @@ namespace System.Management.Automation.Remoting int result = (int)WSManPluginErrorCodes.NoError; - //there should have been a receive request in place already + // there should have been a receive request in place already lock (_syncObject) { @@ -231,7 +231,7 @@ namespace System.Management.Automation.Remoting if (flush) flags |= (int)WSManNativeApi.WSManFlagReceive.WSMAN_FLAG_RECEIVE_FLUSH; if (reportAsDataBoundary) - //currently assigning hardcoded value for this flag, this is a new change in wsman.h and needs to be replaced with the actual definition once + // currently assigning hardcoded value for this flag, this is a new change in wsman.h and needs to be replaced with the actual definition once // modified wsman.h is in public headers flags |= (int)WSManNativeApi.WSManFlagReceive.WSMAN_FLAG_RECEIVE_RESULT_DATA_BOUNDARY; diff --git a/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs b/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs index 4b525201a2..f93831b2af 100644 --- a/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs +++ b/src/System.Management.Automation/engine/remoting/fanin/WSManTransportManager.cs @@ -116,9 +116,9 @@ namespace System.Management.Automation.Remoting.Client { PSRemotingTransportException e; - //For the first two special error conditions, it is remotely possible that the wsmanSessionTM is null when the failures are returned - //as part of command TM operations (could be returned because of RC retries under the hood) - //Not worth to handle these cases separately as there are very corner scenarios, but need to make sure wsmanSessionTM is not referenced + // For the first two special error conditions, it is remotely possible that the wsmanSessionTM is null when the failures are returned + // as part of command TM operations (could be returned because of RC retries under the hood) + // Not worth to handle these cases separately as there are very corner scenarios, but need to make sure wsmanSessionTM is not referenced // Destination server is reporting that URI redirect is required for this user. if ((errorStruct.errorCode == WSManNativeApi.ERROR_WSMAN_REDIRECT_REQUESTED) && (wsmanSessionTM != null)) @@ -452,7 +452,7 @@ namespace System.Management.Automation.Remoting.Client private static Dictionary s_sessionTMHandles = new Dictionary(); private static long s_sessionTMSeed; - //generate unique session id + // generate unique session id private static long GetNextSessionTMHandleId() { return System.Threading.Interlocked.Increment(ref s_sessionTMSeed); @@ -830,7 +830,7 @@ namespace System.Management.Automation.Remoting.Client // startup info WSManNativeApi.WSManShellDisconnectInfo disconnectInfo = new WSManNativeApi.WSManShellDisconnectInfo(uIdleTimeout); - //Add ETW traces + // Add ETW traces // disconnect Callback _disconnectSessionCompleted = new WSManNativeApi.WSManShellAsync(new IntPtr(_sessionContextID), s_sessionDisconnectCallback); @@ -868,7 +868,7 @@ namespace System.Management.Automation.Remoting.Client Dbg.Assert(!isClosed, "object already disposed"); ReceivedDataCollection.PrepareForStreamConnect(); - //Add ETW traces + // Add ETW traces // reconnect Callback _reconnectSessionCompleted = new WSManNativeApi.WSManShellAsync(new IntPtr(_sessionContextID), s_sessionReconnectCallback); @@ -925,13 +925,13 @@ namespace System.Management.Automation.Remoting.Client _openContent = new WSManNativeApi.WSManData_ManToUn(base64EncodedDataInXml); } - //THERE SHOULD BE NO ADDITIONAL DATA. If there is, it means we are not able to push all initial negotiation related data + // THERE SHOULD BE NO ADDITIONAL DATA. If there is, it means we are not able to push all initial negotiation related data // as part of Connect SOAP. The connect algorithm is based on this assumption. So bail out. additionalData = dataToBeSent.ReadOrRegisterCallback(null, out additionalDataType); if (additionalData != null) { - //Negotiation payload does not fit in ConnectShell. bail out. - //Assert for now. should be replaced with raising an exception so upper layers can catch. + // Negotiation payload does not fit in ConnectShell. bail out. + // Assert for now. should be replaced with raising an exception so upper layers can catch. Dbg.Assert(false, "Negotiation payload does not fit in ConnectShell"); return; } @@ -941,7 +941,7 @@ namespace System.Management.Automation.Remoting.Client _sessionContextID = GetNextSessionTMHandleId(); AddSessionTransportManager(_sessionContextID, this); - //session is implicitly assumed to support disconnect + // session is implicitly assumed to support disconnect SupportsDisconnect = true; // Create Callback @@ -967,7 +967,7 @@ namespace System.Management.Automation.Remoting.Client WSManNativeApi.WSManConnectShellEx(_wsManSessionHandle, flags, ConnectionInfo.ShellUri, - RunspacePoolInstanceId.ToString().ToUpperInvariant(), //wsman is case sensitive wrt shellId. so consistently using upper case + RunspacePoolInstanceId.ToString().ToUpperInvariant(), // wsman is case sensitive wrt shellId. so consistently using upper case IntPtr.Zero, _openContent, _connectSessionCallback, @@ -1226,7 +1226,7 @@ namespace System.Management.Automation.Remoting.Client return; } - //TODO - On unexpected failures on a reconstructed session... we dont want to close server session + // TODO - On unexpected failures on a reconstructed session... we dont want to close server session PSEtwLog.LogAnalyticInformational(PSEventId.WSManCloseShell, PSOpcode.Disconnect, PSTask.None, PSKeyword.Transport | PSKeyword.UseAlwaysAnalytic, RunspacePoolInstanceId.ToString()); @@ -1265,7 +1265,7 @@ namespace System.Management.Automation.Remoting.Client throw exception; } - //retrieve the packet size again + // retrieve the packet size again int packetSize; WSManNativeApi.WSManGetSessionOptionAsDword(_wsManSessionHandle, WSManNativeApi.WSManSessionOption.WSMAN_OPTION_SHELL_MAX_DATA_SIZE_PER_MESSAGE_KB, @@ -1310,7 +1310,7 @@ namespace System.Management.Automation.Remoting.Client PSOpcode.Connect, PSTask.None, PSKeyword.Transport | PSKeyword.UseAlwaysAnalytic, RunspacePoolInstanceId.ToString(), newUri.ToString()); Initialize(newUri, (WSManConnectionInfo)connectionInfo); - //reset startmode + // reset startmode _startMode = WSManTransportManagerUtils.tmStartModes.None; CreateAsync(); } @@ -1901,7 +1901,7 @@ namespace System.Management.Automation.Remoting.Client } } - //check if the session supports disconnect + // check if the session supports disconnect sessionTM.SupportsDisconnect = ((flags & (int)WSManNativeApi.WSManCallbackFlags.WSMAN_FLAG_CALLBACK_SHELL_SUPPORTS_DISCONNECT) != 0) ? true : false; // openContent is used by redirection ie., while redirecting to @@ -2012,7 +2012,7 @@ namespace System.Management.Automation.Remoting.Client return; } - //LOG ETW EVENTS + // LOG ETW EVENTS // Dispose the OnDisconnect callback as it is not needed anymore if (sessionTM._disconnectSessionCompleted != null) @@ -2055,7 +2055,7 @@ namespace System.Management.Automation.Remoting.Client sessionTM.EnqueueAndStartProcessingThread(null, null, new CompletionEventArgs(CompletionNotification.DisconnectCompleted)); - //Log ETW traces + // Log ETW traces } return; @@ -2080,7 +2080,7 @@ namespace System.Management.Automation.Remoting.Client return; } - //Add ETW events + // Add ETW events // Dispose the OnCreate callback as it is not needed anymore if (sessionTM._reconnectSessionCompleted != null) @@ -2213,7 +2213,7 @@ namespace System.Management.Automation.Remoting.Client } } - //dispose openContent + // dispose openContent if (sessionTM._openContent != null) { sessionTM._openContent.Dispose(); @@ -2230,7 +2230,7 @@ namespace System.Management.Automation.Remoting.Client } } - //process returned Xml + // process returned Xml Dbg.Assert(data != null, "WSManConnectShell callback returned null data"); WSManNativeApi.WSManConnectDataResult connectData = WSManNativeApi.WSManConnectDataResult.UnMarshal(data); if (connectData.data != null) @@ -3994,7 +3994,7 @@ namespace System.Management.Automation.Remoting.Client new Dictionary(); private static long s_cmdTMSeed; - //Generate command transport manager unique id + // Generate command transport manager unique id private static long GetNextCmdTMHandleId() { return System.Threading.Interlocked.Increment(ref s_cmdTMSeed); diff --git a/src/System.Management.Automation/engine/remoting/server/ServerPowerShellDriver.cs b/src/System.Management.Automation/engine/remoting/server/ServerPowerShellDriver.cs index 177ac3b470..8a9e5307a6 100644 --- a/src/System.Management.Automation/engine/remoting/server/ServerPowerShellDriver.cs +++ b/src/System.Management.Automation/engine/remoting/server/ServerPowerShellDriver.cs @@ -520,7 +520,7 @@ namespace System.Management.Automation // be disposed as raising the events is // not done towards the end. Need to fix // powershell in order to get this enabled - //localPowerShell.Dispose(); + // localPowerShell.Dispose(); } } @@ -742,7 +742,7 @@ namespace System.Management.Automation _localPowerShellOutput.Clear(); - //foreach (ErrorRecord errorRecord in localPowerShell.Error) + // foreach (ErrorRecord errorRecord in localPowerShell.Error) for (int i = 0; i < LocalPowerShell.Streams.Error.Count; i++) { ErrorRecord errorRecord = LocalPowerShell.Streams.Error[i]; @@ -845,11 +845,11 @@ namespace System.Management.Automation private void HandleSessionConnected(object sender, EventArgs eventArgs) { - //Close input if its active. no need to synchronize as input stream would have already been processed + // Close input if its active. no need to synchronize as input stream would have already been processed // when connect call came into PS plugin if (InputCollection != null) { - //TODO: Post an ETW event + // TODO: Post an ETW event InputCollection.Complete(); } } diff --git a/src/System.Management.Automation/engine/remoting/server/ServerRemotingProtocol2.cs b/src/System.Management.Automation/engine/remoting/server/ServerRemotingProtocol2.cs index 262f9a567e..8813d62cb1 100644 --- a/src/System.Management.Automation/engine/remoting/server/ServerRemotingProtocol2.cs +++ b/src/System.Management.Automation/engine/remoting/server/ServerRemotingProtocol2.cs @@ -144,7 +144,7 @@ namespace System.Management.Automation RemoteHostResponse remoteHostResponse = RemoteHostResponse.Decode(receivedData.Data); - //part of host message robustness algo. Now the host response is back, report to transport that + // part of host message robustness algo. Now the host response is back, report to transport that // execution status is back to running _transportManager.ReportExecutionStatusAsRunning(); @@ -658,7 +658,7 @@ namespace System.Management.Automation RemoteHostResponse remoteHostResponse = RemoteHostResponse.Decode(receivedData.Data); - //part of host message robustness algo. Now the host response is back, report to transport that + // part of host message robustness algo. Now the host response is back, report to transport that // execution status is back to running _transportManager.ReportExecutionStatusAsRunning(); diff --git a/src/System.Management.Automation/engine/remoting/server/ServerSteppablePipelineDriver.cs b/src/System.Management.Automation/engine/remoting/server/ServerSteppablePipelineDriver.cs index 0bae939725..cd706551b6 100644 --- a/src/System.Management.Automation/engine/remoting/server/ServerSteppablePipelineDriver.cs +++ b/src/System.Management.Automation/engine/remoting/server/ServerSteppablePipelineDriver.cs @@ -66,7 +66,7 @@ namespace System.Management.Automation // associated with this powershell // data structure handler object to handle all // communications with the client - //private bool datasent = false; // if the remaining data has been sent + // private bool datasent = false; // if the remaining data has been sent // to the client before sending state // information // data to client @@ -305,7 +305,7 @@ namespace System.Management.Automation private void HandleSessionConnected(object sender, EventArgs eventArgs) { - //Close input if its active. no need to synchronize as input stream would have already been processed + // Close input if its active. no need to synchronize as input stream would have already been processed // when connect call came into PS plugin if (Input != null) { diff --git a/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs b/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs index c85ab9d646..940bcec134 100644 --- a/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs +++ b/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs @@ -384,7 +384,7 @@ namespace System.Management.Automation.Remoting private void HandlePublicKeyReceived(object sender, RemoteDataEventArgs eventArgs) { if (SessionDataStructureHandler.StateMachine.State == RemoteSessionState.Established || - SessionDataStructureHandler.StateMachine.State == RemoteSessionState.EstablishedAndKeyRequested || //this is only for legacy clients + SessionDataStructureHandler.StateMachine.State == RemoteSessionState.EstablishedAndKeyRequested || // this is only for legacy clients SessionDataStructureHandler.StateMachine.State == RemoteSessionState.EstablishedAndKeyExchanged) { string remotePublicKey = eventArgs.Data; @@ -515,11 +515,11 @@ namespace System.Management.Automation.Remoting if (totalDataLen < FragmentedRemoteObject.HeaderLength) { - //raise exception + // raise exception throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnInputValidation); } - //TODO: Follow up on comment from Krishna regarding having the serialization/deserialization separate for this + // TODO: Follow up on comment from Krishna regarding having the serialization/deserialization separate for this // operation. This could be integrated as helper functions in fragmentor/serializer components long fragmentId = FragmentedRemoteObject.GetFragmentId(connectData, 0); bool sFlag = FragmentedRemoteObject.GetIsStartFragment(connectData, 0); @@ -528,7 +528,7 @@ namespace System.Management.Automation.Remoting if (blobLength > totalDataLen - FragmentedRemoteObject.HeaderLength) { - //raise exception + // raise exception throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnInputValidation); } @@ -537,7 +537,7 @@ namespace System.Management.Automation.Remoting throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnInputValidation); } - //if session is not in expected state + // if session is not in expected state RemoteSessionState currentState = SessionDataStructureHandler.StateMachine.State; if (currentState != RemoteSessionState.Established && currentState != RemoteSessionState.EstablishedAndKeyExchanged) @@ -545,7 +545,7 @@ namespace System.Management.Automation.Remoting throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnServerStateValidation); } - //process first message + // process first message MemoryStream serializedStream = new MemoryStream(); serializedStream.Write(connectData, FragmentedRemoteObject.HeaderLength, blobLength); @@ -562,7 +562,7 @@ namespace System.Management.Automation.Remoting throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnInputValidation); } - //process second message + // process second message int secondFragmentLength = totalDataLen - FragmentedRemoteObject.HeaderLength - blobLength; if (secondFragmentLength < FragmentedRemoteObject.HeaderLength) { @@ -587,7 +587,7 @@ namespace System.Management.Automation.Remoting throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnInputValidation); } - //process second message + // process second message serializedStream = new MemoryStream(); serializedStream.Write(secondFragment, FragmentedRemoteObject.HeaderLength, blobLength); @@ -604,7 +604,7 @@ namespace System.Management.Automation.Remoting throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnInputValidation); } - //We have the two objects required for validating the connect operation + // We have the two objects required for validating the connect operation RemoteSessionCapability clientCapability; try { @@ -626,7 +626,7 @@ namespace System.Management.Automation.Remoting throw ex; } - //validate client connect_runspacepool request + // validate client connect_runspacepool request int clientRequestedMinRunspaces = -1; int clientRequestedMaxRunspaces = -1; bool clientRequestedRunspaceCount = false; @@ -644,7 +644,7 @@ namespace System.Management.Automation.Remoting } } - //these should be positive and max should be greater than min + // these should be positive and max should be greater than min if (clientRequestedRunspaceCount && (clientRequestedMinRunspaces == -1 || clientRequestedMaxRunspaces == -1 || clientRequestedMinRunspaces > clientRequestedMaxRunspaces)) { @@ -656,16 +656,16 @@ namespace System.Management.Automation.Remoting throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnServerStateValidation); } - //currently only one runspace pool per session is allowed. make sure this ID in connect message is the same + // currently only one runspace pool per session is allowed. make sure this ID in connect message is the same if (connectRunspacePoolObject.RunspacePoolId != _runspacePoolDriver.InstanceId) { throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnInputValidation); } - //we currently dont support adjusting runspace count on a connect operation. - //there is a potential race here where in the runspace pool driver is still yet to process a queued - //setMax or setMinrunspaces request. - //TODO: resolve this race.. probably by letting the runspace pool consume all messages before we execute this. + // we currently dont support adjusting runspace count on a connect operation. + // there is a potential race here where in the runspace pool driver is still yet to process a queued + // setMax or setMinrunspaces request. + // TODO: resolve this race.. probably by letting the runspace pool consume all messages before we execute this. if (clientRequestedRunspaceCount && (_runspacePoolDriver.RunspacePool.GetMaxRunspaces() != clientRequestedMaxRunspaces) && (_runspacePoolDriver.RunspacePool.GetMinRunspaces() != clientRequestedMinRunspaces)) @@ -680,9 +680,9 @@ namespace System.Management.Automation.Remoting _runspacePoolDriver.RunspacePool.GetMaxRunspaces(), _runspacePoolDriver.RunspacePool.GetMinRunspaces()); - //having this stream operating separately will result in out of sync fragment Ids. but this is still OK - //as this is executed only when connecting from a new client that does not have any previous fragments context. - //no problem even if fragment Ids in this response and the sessiontransport stream clash (interfere) and its guaranteed + // having this stream operating separately will result in out of sync fragment Ids. but this is still OK + // as this is executed only when connecting from a new client that does not have any previous fragments context. + // no problem even if fragment Ids in this response and the sessiontransport stream clash (interfere) and its guaranteed // that the fragments in connect response are always complete (enclose a complete object). SerializedDataStream stream = new SerializedDataStream(4 * 1024);//Each message with fragment headers cannot cross 4k stream.Enter(); @@ -694,10 +694,10 @@ namespace System.Management.Automation.Remoting byte[] outbuffer = stream.Read(); Dbg.Assert(outbuffer != null, "connect response data should be serialized"); stream.Dispose(); - //we are done + // we are done connectResponseData = outbuffer; - //enqueue a connect event in state machine to let session do any other post-connect operation + // enqueue a connect event in state machine to let session do any other post-connect operation // Do this outside of the synchronous connect operation, as otherwise connect can easily get deadlocked ThreadPool.QueueUserWorkItem(new WaitCallback( delegate (object state) @@ -710,7 +710,7 @@ namespace System.Management.Automation.Remoting return; } - //pass on application private data when session is connected from new client + // pass on application private data when session is connected from new client internal void HandlePostConnect() { if (_runspacePoolDriver != null) diff --git a/src/System.Management.Automation/engine/remoting/server/serverremotesessionstatemachine.cs b/src/System.Management.Automation/engine/remoting/server/serverremotesessionstatemachine.cs index acfa78727d..c1bb66a974 100644 --- a/src/System.Management.Automation/engine/remoting/server/serverremotesessionstatemachine.cs +++ b/src/System.Management.Automation/engine/remoting/server/serverremotesessionstatemachine.cs @@ -121,7 +121,7 @@ namespace System.Management.Automation.Remoting _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyReceived, (int)RemoteSessionEvent.KeySendFailed] += DoKeyExchange; _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyReceived, (int)RemoteSessionEvent.KeySent] += DoKeyExchange; - //with connect, a new client can negotiate a key change to a server that has already negotiated key exchange with a previous client + // with connect, a new client can negotiate a key change to a server that has already negotiated key exchange with a previous client _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyExchanged, (int)RemoteSessionEvent.KeyReceived] += DoKeyExchange; // _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyExchanged, (int)RemoteSessionEvent.KeyRequested] += DoKeyExchange; // _stateMachineHandle[(int)RemoteSessionState.EstablishedAndKeyExchanged, (int)RemoteSessionEvent.KeyReceiveFailed] += DoKeyExchange; // @@ -167,7 +167,7 @@ namespace System.Management.Automation.Remoting if (arg.StateEvent == RemoteSessionEvent.MessageReceived) { if (_state == RemoteSessionState.Established || - _state == RemoteSessionState.EstablishedAndKeySent || //server session will never be in this state.. TODO- remove this + _state == RemoteSessionState.EstablishedAndKeySent || // server session will never be in this state.. TODO- remove this _state == RemoteSessionState.EstablishedAndKeyReceived || _state == RemoteSessionState.EstablishedAndKeyExchanged) { @@ -209,7 +209,7 @@ namespace System.Management.Automation.Remoting // currently server state machine doesn't raise events // this will allow server state machine to raise events. - //RaiseStateMachineEvents(); + // RaiseStateMachineEvents(); } /// @@ -497,7 +497,7 @@ namespace System.Management.Automation.Remoting Dbg.Assert(_state == RemoteSessionState.Established || _state == RemoteSessionState.EstablishedAndKeyExchanged || _state == RemoteSessionState.EstablishedAndKeyReceived || - _state == RemoteSessionState.EstablishedAndKeySent, //server session will never be in this state.. TODO- remove this + _state == RemoteSessionState.EstablishedAndKeySent, // server session will never be in this state.. TODO- remove this "State must be Established or EstablishedAndKeySent or EstablishedAndKeyReceived or EstablishedAndKeyExchanged"); RemotingTargetInterface targetInterface = fsmEventArg.RemoteData.TargetInterface; @@ -505,7 +505,7 @@ namespace System.Management.Automation.Remoting Guid clientRunspacePoolId; ServerRunspacePoolDriver runspacePoolDriver; - //string errorMessage = null; + // string errorMessage = null; RemoteDataEventArgs remoteDataForSessionArg = null; @@ -688,7 +688,7 @@ namespace System.Management.Automation.Remoting case RemoteSessionState.Connecting: case RemoteSessionState.Connected: case RemoteSessionState.Established: - case RemoteSessionState.EstablishedAndKeySent: //server session will never be in this state.. TODO- remove this + case RemoteSessionState.EstablishedAndKeySent: // server session will never be in this state.. TODO- remove this case RemoteSessionState.EstablishedAndKeyReceived: case RemoteSessionState.EstablishedAndKeyExchanged: case RemoteSessionState.NegotiationReceived: @@ -899,9 +899,9 @@ namespace System.Management.Automation.Remoting /// Event args. private void DoKeyExchange(object sender, RemoteSessionStateMachineEventArgs eventArgs) { - //There are corner cases with disconnect that can result in client receiving outdated key exchange packets - //***TODO*** Deal with this on the client side. Key exchange packets should have additional information - //that identify the context of negotiation. Just like callId in SetMax and SetMinRunspaces messages + // There are corner cases with disconnect that can result in client receiving outdated key exchange packets + // ***TODO*** Deal with this on the client side. Key exchange packets should have additional information + // that identify the context of negotiation. Just like callId in SetMax and SetMinRunspaces messages Dbg.Assert(_state >= RemoteSessionState.Established, "Key Receiving can only be raised after reaching the Established state"); @@ -909,7 +909,7 @@ namespace System.Management.Automation.Remoting { case RemoteSessionEvent.KeyReceived: { - //does the server ever start key exchange process??? This may not be required + // does the server ever start key exchange process??? This may not be required if (_state == RemoteSessionState.EstablishedAndKeyRequested) { // reset the timer diff --git a/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs b/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs index 991c2ae724..48ab754db7 100644 --- a/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs +++ b/src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs @@ -1881,7 +1881,7 @@ namespace System.Management.Automation } #if false - //This code can be used when adding a new pattern. + // This code can be used when adding a new pattern. internal static uint HashNewPattern(string pattern) { char ToLower(char c) @@ -2325,9 +2325,9 @@ namespace System.Management.Automation commandRuntime = null; currentObjectInPipeline = null; _input.Clear(); - //_scriptBlock = null; - //_localsTuple = null; - //_functionContext = null; + // _scriptBlock = null; + // _localsTuple = null; + // _functionContext = null; base.InternalDispose(true); _disposed = true; diff --git a/src/System.Management.Automation/engine/runtime/MutableTuple.cs b/src/System.Management.Automation/engine/runtime/MutableTuple.cs index c3db7a9bb9..703d76b605 100644 --- a/src/System.Management.Automation/engine/runtime/MutableTuple.cs +++ b/src/System.Management.Automation/engine/runtime/MutableTuple.cs @@ -266,7 +266,7 @@ namespace System.Management.Automation /// public static Type MakeTupleType(params Type[] types) { - //ContractUtils.RequiresNotNull(types, "types"); + // ContractUtils.RequiresNotNull(types, "types"); return MakeTupleType(types, 0, types.Length); } @@ -276,7 +276,7 @@ namespace System.Management.Automation /// public static int GetSize(Type tupleType) { - //ContractUtils.RequiresNotNull(tupleType, "tupleType"); + // ContractUtils.RequiresNotNull(tupleType, "tupleType"); int count = 0; lock (s_sizeDict) if (s_sizeDict.TryGetValue(tupleType, out count)) return count; @@ -323,8 +323,8 @@ namespace System.Management.Automation /// public static MutableTuple MakeTuple(Type tupleType, Dictionary nameToIndexMap, Func creator = null) { - //ContractUtils.RequiresNotNull(tupleType, "tupleType"); - //ContractUtils.RequiresNotNull(args, "args"); + // ContractUtils.RequiresNotNull(tupleType, "tupleType"); + // ContractUtils.RequiresNotNull(args, "args"); int size = GetSize(tupleType); var bitArray = new BitArray(size); @@ -338,7 +338,7 @@ namespace System.Management.Automation /// public static object[] GetTupleValues(MutableTuple tuple) { - //ContractUtils.RequiresNotNull(tuple, "tuple"); + // ContractUtils.RequiresNotNull(tuple, "tuple"); List res = new List(); @@ -360,7 +360,7 @@ namespace System.Management.Automation /// internal static IEnumerable GetAccessProperties(Type tupleType, int size, int index) { - //ContractUtils.RequiresNotNull(tupleType, "tupleType"); + // ContractUtils.RequiresNotNull(tupleType, "tupleType"); if (index < 0 || index >= size) throw new ArgumentException("index"); diff --git a/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs b/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs index 3b052cba7f..4dbed59c71 100644 --- a/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs +++ b/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs @@ -892,7 +892,7 @@ namespace System.Management.Automation ParserStrings.RedirectionStreamCanOnlyMergeToOutputStream); } - //this.ToStream = to; + // this.ToStream = to; } public override string ToString() @@ -902,7 +902,7 @@ namespace System.Management.Automation : string.Format(CultureInfo.InvariantCulture, "{0}>&1", (int)FromStream); } - //private RedirectionStream ToStream { get; set; } + // private RedirectionStream ToStream { get; set; } // Handle merging redirections for commands, like: // dir 2>&1 diff --git a/src/System.Management.Automation/engine/serialization.cs b/src/System.Management.Automation/engine/serialization.cs index b30ed10198..4c0ecb9025 100644 --- a/src/System.Management.Automation/engine/serialization.cs +++ b/src/System.Management.Automation/engine/serialization.cs @@ -536,7 +536,7 @@ namespace System.Management.Automation Dbg.Assert(_reader.NodeType == XmlNodeType.None, "When deserialization starts we should have XmlReader.NodeType == None"); _reader.Read(); - //If version is not provided, we assume it is the default + // If version is not provided, we assume it is the default string version = InternalSerializer.DefaultVersion; if (DeserializationOptions.NoRootElement == (_context.options & DeserializationOptions.NoRootElement)) { @@ -548,14 +548,14 @@ namespace System.Management.Automation _reader.MoveToContent(); Dbg.Assert(_reader.EOF || (_reader.NodeType == XmlNodeType.Element), "When deserialization starts reading we should have XmlReader.NodeType == Element"); - //Read version attribute and validate it. + // Read version attribute and validate it. string versionAttribute = _reader.GetAttribute(SerializationStrings.VersionAttribute); if (versionAttribute != null) { version = versionAttribute; } - //If the root element tag is empty, there are no objects to read. + // If the root element tag is empty, there are no objects to read. if (!_deserializer.ReadStartElementAndHandleEmpty(SerializationStrings.RootElementTag)) { _done = true; @@ -904,7 +904,7 @@ namespace System.Management.Automation internal static bool IsPrimitiveKnownType(Type input) { - //Check if source is of primitive known type + // Check if source is of primitive known type TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfo(input); return (pktInfo != null); } @@ -961,8 +961,8 @@ namespace System.Management.Automation return; } - //Object is not of primitive known type. Check if this has - //already been serialized. + // Object is not of primitive known type. Check if this has + // already been serialized. string refId = _objectRefIdHandler.GetRefId(source); if (refId != null) { @@ -975,16 +975,16 @@ namespace System.Management.Automation return; } - //Note: We do not use containers in depth calculation. i.e even if the - //current depth is zero, we serialize the container. All contained items will - //get serialized with depth zero. + // Note: We do not use containers in depth calculation. i.e even if the + // current depth is zero, we serialize the container. All contained items will + // get serialized with depth zero. if (HandleKnownContainerTypes(source, streamName, property, depth)) { return; } PSObject mshSource = PSObject.AsPSObject(source); - //If depth is zero, complex type should be serialized as string. + // If depth is zero, complex type should be serialized as string. if (depth == 0 || SerializeAsString(mshSource)) { HandlePSObjectAsString(mshSource, streamName, property, depth); @@ -1036,7 +1036,7 @@ namespace System.Management.Automation { Dbg.Assert(source != null, "caller should validate the parameter"); - //Check if source is of primitive known type + // Check if source is of primitive known type TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfo(source.GetType()); if (pktInfo != null) { @@ -1066,7 +1066,7 @@ namespace System.Management.Automation ) { Dbg.Assert(source != null, "caller should validate the parameter"); - //Check if source is of primitive known type + // Check if source is of primitive known type TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfo(source.GetType()); if (pktInfo != null) { @@ -1136,9 +1136,9 @@ namespace System.Management.Automation WriteAttribute(SerializationStrings.StreamNameAttribute, streamName); } - //Note: We do not use WriteRaw for serializing secure string. WriteString - //does necessary escaping which may be needed for certain - //characters. + // Note: We do not use WriteRaw for serializing secure string. WriteString + // does necessary escaping which may be needed for certain + // characters. _writer.WriteString(encryptedString); _writer.WriteEndElement(); @@ -1179,7 +1179,7 @@ namespace System.Management.Automation PSObject moSource = source as PSObject; if (moSource != null && !moSource.immediateBaseObjectIsEmpty) { - //Check if baseObject is primitive known type + // Check if baseObject is primitive known type object baseObject = moSource.ImmediateBaseObject; TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfo(baseObject.GetType()); if (pktInfo != null) @@ -1207,13 +1207,13 @@ namespace System.Management.Automation IEnumerable enumerable = null; IDictionary dictionary = null; - //If passed in object is PSObject with no baseobject, return false. + // If passed in object is PSObject with no baseobject, return false. if (mshSource != null && mshSource.immediateBaseObjectIsEmpty) { return false; } - //Check if source (or baseobject in mshSource) is known container type + // Check if source (or baseobject in mshSource) is known container type SerializationUtilities.GetKnownContainerTypeInfo(mshSource != null ? mshSource.ImmediateBaseObject : source, out ct, out dictionary, out enumerable); @@ -1661,7 +1661,7 @@ namespace System.Management.Automation { Dbg.Assert(mshObject != null, "caller should validate the parameter"); - //Write PSObject start element. + // Write PSObject start element. WriteStartElement(SerializationStrings.PSObjectTag); if (streamName != null) @@ -1681,7 +1681,7 @@ namespace System.Management.Automation if (writeTypeNames) { - //Write TypeNames + // Write TypeNames ConsolidatedString typeNames = mshObject.InternalTypeNames; if (typeNames.Count > 0) { @@ -1690,7 +1690,7 @@ namespace System.Management.Automation { WriteStartElement(SerializationStrings.TypeNamesTag); - //Create a new refId and write it as attribute + // Create a new refId and write it as attribute string tnRefId = _typeRefIdHandler.SetRefId(typeNames); Dbg.Assert(tnRefId != null, "SetRefId should always succeed for strings"); WriteAttribute(SerializationStrings.ReferenceIdAttribute, tnRefId); @@ -1853,7 +1853,7 @@ namespace System.Management.Automation { Dbg.Assert(source != null, "caller should validate the information"); - //Depth available for each property is one less + // Depth available for each property is one less --depth; Dbg.Assert(depth >= 0, "depth should be greater or equal to zero"); @@ -1881,7 +1881,7 @@ namespace System.Management.Automation int depth ) { - //Serialize instanceMembers + // Serialize instanceMembers Dbg.Assert(source != null, "caller should validate the information"); PSMemberInfoCollection instanceMembers = source.InstanceMembers; if (instanceMembers != null) @@ -2032,7 +2032,7 @@ namespace System.Management.Automation Dbg.Assert(enumerable != null, "caller should validate the parameter"); Dbg.Assert(!string.IsNullOrEmpty(tag), "caller should validate the parameter"); - //Start element + // Start element WriteStartElement(tag); IEnumerator enumerator = null; @@ -2045,7 +2045,7 @@ namespace System.Management.Automation } catch (System.NotSupportedException) { - //ignore exceptions thrown when the enumerator doesn't support Reset() method as in win8:948569 + // ignore exceptions thrown when the enumerator doesn't support Reset() method as in win8:948569 } } catch (Exception exception) @@ -2060,8 +2060,8 @@ namespace System.Management.Automation enumerator = null; } - //AD has incorrect implementation of IEnumerable where they returned null - //for GetEnumerator instead of empty enumerator + // AD has incorrect implementation of IEnumerable where they returned null + // for GetEnumerator instead of empty enumerator if (enumerator != null) { while (true) @@ -2093,7 +2093,7 @@ namespace System.Management.Automation WriteOneObject(item, null, null, depth); } } - //End element + // End element _writer.WriteEndElement(); } @@ -2113,7 +2113,7 @@ namespace System.Management.Automation Dbg.Assert(dictionary != null, "caller should validate the parameter"); Dbg.Assert(!string.IsNullOrEmpty(tag), "caller should validate the parameter"); - //Start element + // Start element WriteStartElement(tag); IDictionaryEnumerator dictionaryEnum = null; @@ -2171,7 +2171,7 @@ namespace System.Management.Automation } } - //End element + // End element _writer.WriteEndElement(); } @@ -2559,9 +2559,9 @@ namespace System.Management.Automation serializer.WriteAttribute(SerializationStrings.StreamNameAttribute, streamName); } - //Note: We do not use WriteRaw for serializing string. WriteString - //does necessary escaping which may be needed for certain - //characters. + // Note: We do not use WriteRaw for serializing string. WriteString + // does necessary escaping which may be needed for certain + // characters. Dbg.Assert(source is string, "Caller should verify that typeof(source) is String"); string s = (string)source; string encoded = EncodeString(s); @@ -2601,7 +2601,7 @@ namespace System.Management.Automation Dbg.Assert(source != null, "caller should have validated the information"); Dbg.Assert(entry != null, "caller should have validated the information"); - //Char is defined as unsigned short in schema + // Char is defined as unsigned short in schema WriteRawString(serializer, streamName, property, XmlConvert.ToString((UInt16)(Char)source), entry); } @@ -2951,8 +2951,8 @@ namespace System.Management.Automation get { Dbg.Assert(_version.Major <= 1, "Deserializer assumes clixml version is <= 1.1"); - //If minor version is greater than 1, it means that there can be - //some unknown tags in xml. Deserialization should ignore such element. + // If minor version is greater than 1, it means that there can be + // some unknown tags in xml. Deserialization should ignore such element. return (_version.Minor > 1); } } @@ -3076,15 +3076,15 @@ namespace System.Management.Automation throw NewXmlException(Serialization.InvalidVersion, exceptionToRethrow); } - //Versioning Note:Future version of serialization can add new known types. - //This version will ignore those known types, if they are base object. - //It is expected that future version will still put information in base - //and adapter properties which this serializer can read and use. - //For example, assume the version 2 serialization engine supports a new known - //type IPAddress. The version 1 deserializer doesn't know IPAddress as known - //type and it must retrieve it as an PSObject. The version 2 serializer - //can serialize this as follows: - // + // Versioning Note:Future version of serialization can add new known types. + // This version will ignore those known types, if they are base object. + // It is expected that future version will still put information in base + // and adapter properties which this serializer can read and use. + // For example, assume the version 2 serialization engine supports a new known + // type IPAddress. The version 1 deserializer doesn't know IPAddress as known + // type and it must retrieve it as an PSObject. The version 2 serializer + // can serialize this as follows: + // // ... // // 120.23.35.53 @@ -3093,13 +3093,13 @@ namespace System.Management.Automation // 120.23.34.53 // A // - // + // // In above example, V1 serializer will ignore element and read // properties from // V2 serializer can read tag and ignore properties. // Read serialization note doc for information. - //Now validate the major version number is 1 + // Now validate the major version number is 1 if (_version.Major != 1) { throw NewXmlException(Serialization.UnexpectedVersion, null, _version.Major); @@ -3119,14 +3119,14 @@ namespace System.Management.Automation streamName = _reader.GetAttribute(SerializationStrings.StreamNameAttribute); isKnownPrimitiveType = false; - //handle nil node + // handle nil node if (IsNextElement(SerializationStrings.NilTag)) { Skip(); return null; } - //Handle reference to previous deserialized object. + // Handle reference to previous deserialized object. if (IsNextElement(SerializationStrings.ReferenceTag)) { string refId = _reader.GetAttribute(SerializationStrings.ReferenceIdAttribute); @@ -3146,7 +3146,7 @@ namespace System.Management.Automation return duplicate; } - //Handle primitive known types + // Handle primitive known types TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfoFromItemTag(_reader.LocalName); if (pktInfo != null) { @@ -3155,15 +3155,15 @@ namespace System.Management.Automation return ReadPrimaryKnownType(pktInfo); } - //Handle PSObject + // Handle PSObject if (IsNextElement(SerializationStrings.PSObjectTag)) { s_trace.WriteLine("PSObject Element"); return ReadPSObject(); } - //If we are here, we have an unknown node. Unknown nodes may - //be allowed inside PSObject. We do not allow them at top level. + // If we are here, we have an unknown node. Unknown nodes may + // be allowed inside PSObject. We do not allow them at top level. s_trace.TraceError("Invalid element {0} tag found", _reader.LocalName); throw NewXmlException(Serialization.InvalidElementTag, null, _reader.LocalName); @@ -3615,20 +3615,20 @@ namespace System.Management.Automation return ReadOneObject(out ignore); } - //Reads one PSObject + // Reads one PSObject private PSObject ReadPSObject() { PSObject dso = ReadAttributeAndCreatePSObject(); - //Read start element tag + // Read start element tag if (ReadStartElementAndHandleEmpty(SerializationStrings.PSObjectTag) == false) { - //Empty element. + // Empty element. return dso; } bool overrideTypeInfo = true; - //Process all the child nodes + // Process all the child nodes while (_reader.NodeType == XmlNodeType.Element) { if (IsNextElement(SerializationStrings.TypeNamesTag) || @@ -3660,11 +3660,11 @@ namespace System.Management.Automation } else { - //Handle BaseObject + // Handle BaseObject object baseObject = null; ContainerType ct = ContainerType.None; - //Check if tag is PrimaryKnownType. + // Check if tag is PrimaryKnownType. TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfoFromItemTag(_reader.LocalName); if (pktInfo != null) { @@ -3683,7 +3683,7 @@ namespace System.Management.Automation } else { - //We have an unknown tag + // We have an unknown tag s_trace.WriteLine("Unknown tag {0} encountered", _reader.LocalName); if (UnknownTagsAllowed) { @@ -3723,7 +3723,7 @@ namespace System.Management.Automation string refId = _reader.GetAttribute(SerializationStrings.ReferenceIdAttribute); PSObject sh = new PSObject(); - //RefId is not mandatory attribute + // RefId is not mandatory attribute if (refId != null) { s_trace.WriteLine("Read PSObject with refId: {0}", refId); @@ -3748,7 +3748,7 @@ namespace System.Management.Automation { Collection typeNames = new Collection(); - //Read refId attribute if available + // Read refId attribute if available string refId = _reader.GetAttribute(SerializationStrings.ReferenceIdAttribute); s_trace.WriteLine("Processing TypeNamesTag with refId {0}", refId); @@ -3808,7 +3808,7 @@ namespace System.Management.Automation ); dso.InternalTypeNames = new ConsolidatedString(typeNames); - //Skip the node + // Skip the node Skip(); } else @@ -3825,21 +3825,21 @@ namespace System.Management.Automation Dbg.Assert(dso != null, "caller should validate the parameter"); Dbg.Assert(_reader.NodeType == XmlNodeType.Element, "NodeType should be Element"); - //Since we are adding baseobject properties as propertybag, - //mark the object as deserialized. + // Since we are adding baseobject properties as propertybag, + // mark the object as deserialized. dso.isDeserialized = true; dso.adaptedMembers = new PSMemberInfoInternalCollection(); - //Add the GetType method to the instance members, so that it works on deserialized psobjects + // Add the GetType method to the instance members, so that it works on deserialized psobjects dso.InstanceMembers.Add(PSObject.dotNetInstanceAdapter.GetDotNetMethod(dso, "GetType")); PSGetMemberBinder.SetHasInstanceMember("GetType"); - //Set Clr members to a collection which is empty + // Set Clr members to a collection which is empty dso.clrMembers = new PSMemberInfoInternalCollection(); if (ReadStartElementAndHandleEmpty(SerializationStrings.AdapterProperties)) { - //Read one or more property elements + // Read one or more property elements while (_reader.NodeType == XmlNodeType.Element) { string property = ReadNameAttribute(); @@ -4011,7 +4011,7 @@ namespace System.Management.Automation { ReadStartElement(SerializationStrings.DictionaryEntryTag); - //Read Key + // Read Key if (_reader.NodeType != XmlNodeType.Element) { throw NewXmlException(Serialization.DictionaryKeyNotSpecified, null); @@ -4029,7 +4029,7 @@ namespace System.Management.Automation { throw NewXmlException(Serialization.NullAsDictionaryKey, null); } - //Read Value + // Read Value if (_reader.NodeType != XmlNodeType.Element) { throw NewXmlException(Serialization.DictionaryValueNotSpecified, null); @@ -4073,7 +4073,7 @@ namespace System.Management.Automation try { - //Add entry to hashtable + // Add entry to hashtable table.Add(key, value); } catch (ArgumentException e) @@ -4105,7 +4105,7 @@ namespace System.Management.Automation xrs.CheckCharacters = false; xrs.CloseInput = false; - //The XML data needs to be in conformance to the rules for a well-formed XML 1.0 document. + // The XML data needs to be in conformance to the rules for a well-formed XML 1.0 document. xrs.ConformanceLevel = ConformanceLevel.Document; xrs.IgnoreComments = true; xrs.IgnoreProcessingInstructions = true; @@ -4430,7 +4430,7 @@ namespace System.Management.Automation } else { - //Scriptblock is deserialized as string + // Scriptblock is deserialized as string return scriptBlockBody; } } @@ -4754,13 +4754,13 @@ namespace System.Management.Automation { Dbg.Assert(!string.IsNullOrEmpty(element), "Caller should validate the parameter"); - //IsEmpty is set to true when element is of the form + // IsEmpty is set to true when element is of the form bool isEmpty = _reader.IsEmptyElement; this.ReadStartElement(element); - //This takes care of the case: or . In - //this case isEmpty is false. + // This takes care of the case: or . In + // this case isEmpty is false. if (isEmpty == false && _reader.NodeType == XmlNodeType.EndElement) { ReadEndElement(); @@ -5137,7 +5137,7 @@ namespace System.Management.Automation #region private_fields - //TypeSerializationInfo for XmlDocument + // TypeSerializationInfo for XmlDocument private static readonly TypeSerializationInfo s_xdInfo = new TypeSerializationInfo(typeof(XmlDocument), SerializationStrings.XmlDocumentTag, @@ -5428,15 +5428,15 @@ namespace System.Management.Automation } } - //Check if type is IEnumerable - //(LanguagePrimitives.GetEnumerable above should be enough - the check below is to preserve + // Check if type is IEnumerable + // (LanguagePrimitives.GetEnumerable above should be enough - the check below is to preserve // backcompatibility in some corner-cases (see bugs in Windows7 - #372562 and #372563)) if (ct == ContainerType.None) { enumerable = source as IEnumerable; if (enumerable != null) { - //WinBlue: 206515 - There are no elements in the source. The source is of type XmlLinkedNode (which derives from XmlNode which implements IEnumerable). + // WinBlue: 206515 - There are no elements in the source. The source is of type XmlLinkedNode (which derives from XmlNode which implements IEnumerable). // So, adding an additional check to see if this contains any elements IEnumerator enumerator = enumerable.GetEnumerator(); if (enumerator != null && enumerator.MoveNext()) diff --git a/src/System.Management.Automation/help/CabinetNativeApi.cs b/src/System.Management.Automation/help/CabinetNativeApi.cs index bb50dd9bc3..a22ad7f3dc 100644 --- a/src/System.Management.Automation/help/CabinetNativeApi.cs +++ b/src/System.Management.Automation/help/CabinetNativeApi.cs @@ -577,7 +577,7 @@ namespace System.Management.Automation.Internal { internal int cb; // LONG internal string psz1; // char FAR * - internal string psz2; //char FAR * + internal string psz2; // char FAR * internal string psz3; // char FAR * internal IntPtr pv; // void FAR * // In this case, it is the destination path internal IntPtr hf; // INT_PTR diff --git a/src/System.Management.Automation/help/DscResourceHelpProvider.cs b/src/System.Management.Automation/help/DscResourceHelpProvider.cs index 78fe7b0b55..ad0dce04a2 100644 --- a/src/System.Management.Automation/help/DscResourceHelpProvider.cs +++ b/src/System.Management.Automation/help/DscResourceHelpProvider.cs @@ -212,7 +212,7 @@ namespace System.Management.Automation if (!string.IsNullOrEmpty(helpFile)) { - //Load the help file only once. Then use it from the cache. + // Load the help file only once. Then use it from the cache. if (!_helpFiles.Contains(helpFile)) { LoadHelpFile(helpFile, helpFile, resourceInfo.Name, reportErrors); diff --git a/src/System.Management.Automation/help/HelpCommentsParser.cs b/src/System.Management.Automation/help/HelpCommentsParser.cs index 2dc9183fa4..d491a99bf1 100644 --- a/src/System.Management.Automation/help/HelpCommentsParser.cs +++ b/src/System.Management.Automation/help/HelpCommentsParser.cs @@ -119,7 +119,7 @@ namespace System.Management.Automation { XmlElement command_parameter = _doc.CreateElement("command:parameter", commandURI); command_parameter.SetAttribute("required", isMandatory ? "true" : "false"); - //command_parameter.SetAttribute("variableLength", "unknown"); + // command_parameter.SetAttribute("variableLength", "unknown"); command_parameter.SetAttribute("globbing", supportsWildcards ? "true" : "false"); string fromPipeline; if (valueFromPipeline && valueFromPipelineByPropertyName) @@ -178,7 +178,7 @@ namespace System.Management.Automation { XmlElement parameterValue = _doc.CreateElement("command:parameterValue", commandURI); parameterValue.SetAttribute("required", isSwitchParameter ? "false" : "true"); - //parameterValue.SetAttribute("variableLength", "unknown"); + // parameterValue.SetAttribute("variableLength", "unknown"); XmlText parameterValue_text = _doc.CreateTextNode(type.Name); command_parameter.AppendChild(parameterValue).AppendChild(parameterValue_text); } diff --git a/src/System.Management.Automation/help/HelpFileHelpProvider.cs b/src/System.Management.Automation/help/HelpFileHelpProvider.cs index c2749d3bd2..60769b6de0 100644 --- a/src/System.Management.Automation/help/HelpFileHelpProvider.cs +++ b/src/System.Management.Automation/help/HelpFileHelpProvider.cs @@ -107,7 +107,7 @@ namespace System.Management.Automation if (filesMatched.Count > 1) { - //Dictionary<, > + // Dictionary<, > Dictionary, Tuple> modulesAndVersion = new Dictionary, Tuple>(); HashSet filesProcessed = new HashSet(); @@ -125,33 +125,33 @@ namespace System.Management.Automation string moduleName = null; GetModuleNameAndVersion(psModulePath, fileFullName, out moduleName, out moduleVersionFromPath); - //Skip modules whose root we cannot determine or which do not have versions. + // Skip modules whose root we cannot determine or which do not have versions. if (moduleVersionFromPath != null && moduleName != null) { Tuple moduleVersion = null; Tuple key = new Tuple(moduleName, fileName); if (modulesAndVersion.TryGetValue(key, out moduleVersion)) { - //Consider for further processing only if the help file name is same. + // Consider for further processing only if the help file name is same. if (filesProcessed.Contains(fileName)) { if (moduleVersionFromPath > moduleVersion.Item2) { modulesAndVersion[key] = new Tuple(fileFullName, moduleVersionFromPath); - //Remove the old file since we found a newer version. + // Remove the old file since we found a newer version. matchedFilesToRemove.Add(moduleVersion.Item1); } else { - //Remove the new file as higher version item is already in dictionary. + // Remove the new file as higher version item is already in dictionary. matchedFilesToRemove.Add(fileFullName); } } } else { - //Add the module to the dictionary as it was not processes earlier. + // Add the module to the dictionary as it was not processes earlier. modulesAndVersion.Add(new Tuple(moduleName, fileName), new Tuple(fileFullName, moduleVersionFromPath)); } @@ -297,11 +297,11 @@ namespace System.Management.Automation { string fileName = Path.GetFileName(path); - //Bug906435: Get-help for special devices throws an exception - //There might be situations where path does not end with .help.txt extension - //The assumption that path ends with .help.txt is broken under special - //conditions when user uses "get-help" with device names like "prn","com1" etc. - //First check whether path ends with .help.txt. + // Bug906435: Get-help for special devices throws an exception + // There might be situations where path does not end with .help.txt extension + // The assumption that path ends with .help.txt is broken under special + // conditions when user uses "get-help" with device names like "prn","com1" etc. + // First check whether path ends with .help.txt. // If path does not end with ".help.txt" return. if (!path.EndsWith(".help.txt", StringComparison.OrdinalIgnoreCase)) diff --git a/src/System.Management.Automation/help/HelpUtils.cs b/src/System.Management.Automation/help/HelpUtils.cs index 34f3f56bbf..c60339a90c 100644 --- a/src/System.Management.Automation/help/HelpUtils.cs +++ b/src/System.Management.Automation/help/HelpUtils.cs @@ -47,18 +47,18 @@ namespace System.Management.Automation if (moduleBase.EndsWith(moduleName, StringComparison.OrdinalIgnoreCase)) { - //This module is not an inbox module, so help goes under / + // This module is not an inbox module, so help goes under / newModuleBase = Path.Combine(userHelpPath, moduleName); } else if (string.Equals(moduleBaseParent, moduleName, StringComparison.OrdinalIgnoreCase)) { - //This module has version folder. + // This module has version folder. var moduleVersion = Path.GetFileName(moduleBase); newModuleBase = Path.Combine(userHelpPath, moduleName, moduleVersion); } else { - //This module is inbox module, help should be under + // This module is inbox module, help should be under newModuleBase = userHelpPath; } diff --git a/src/System.Management.Automation/help/MUIFileSearcher.cs b/src/System.Management.Automation/help/MUIFileSearcher.cs index c4a7a5dab4..5dae8cccbf 100644 --- a/src/System.Management.Automation/help/MUIFileSearcher.cs +++ b/src/System.Management.Automation/help/MUIFileSearcher.cs @@ -269,8 +269,8 @@ namespace System.Management.Automation result.Add(Path.GetFullPath(directory)); } - //user specifically wanted to search in a particular directory - //so return.. + // user specifically wanted to search in a particular directory + // so return.. return result; } diff --git a/src/System.Management.Automation/help/MamlNode.cs b/src/System.Management.Automation/help/MamlNode.cs index 873b74c5d4..c9807f275b 100644 --- a/src/System.Management.Automation/help/MamlNode.cs +++ b/src/System.Management.Automation/help/MamlNode.cs @@ -1105,8 +1105,8 @@ namespace System.Management.Automation /// private static string GetPreformattedText(string text) { - //we are assuming tabsize=4 here. - //It is discouraged to use tab in preformatted text. + // we are assuming tabsize=4 here. + // It is discouraged to use tab in preformatted text. string noTabText = text.Replace("\t", " "); string[] lines = noTabText.Split(Utils.Separators.Newline); diff --git a/src/System.Management.Automation/help/MamlUtil.cs b/src/System.Management.Automation/help/MamlUtil.cs index cd40a8cd87..d019bd746a 100644 --- a/src/System.Management.Automation/help/MamlUtil.cs +++ b/src/System.Management.Automation/help/MamlUtil.cs @@ -33,7 +33,7 @@ namespace System.Management.Automation { if (typename.StartsWith(DefaultCommandHelpObjectBuilder.TypeNameForDefaultHelp, StringComparison.OrdinalIgnoreCase)) { - //Win8: 638494 if the original help is auto-generated, let the Provider help decide the format. + // Win8: 638494 if the original help is auto-generated, let the Provider help decide the format. return; } } diff --git a/src/System.Management.Automation/help/PSClassHelpProvider.cs b/src/System.Management.Automation/help/PSClassHelpProvider.cs index bb3049e6b2..2956d6ad78 100644 --- a/src/System.Management.Automation/help/PSClassHelpProvider.cs +++ b/src/System.Management.Automation/help/PSClassHelpProvider.cs @@ -154,7 +154,7 @@ namespace System.Management.Automation if (dirToSearch.Exists) { searchPaths.Add(dirToSearch.FullName); - helpFileToFind = helpFileInfo.Name; //If external help file is specified. Then use it. + helpFileToFind = helpFileInfo.Name; // If external help file is specified. Then use it. } } @@ -217,7 +217,7 @@ namespace System.Management.Automation if (!string.IsNullOrEmpty(helpFile)) { - //Load the help file only once. Then use it from the cache. + // Load the help file only once. Then use it from the cache. if (!_helpFiles.Contains(helpFile)) { LoadHelpFile(helpFile, helpFile, classInfo.Name, reportErrors); diff --git a/src/System.Management.Automation/logging/MshLog.cs b/src/System.Management.Automation/logging/MshLog.cs index 35830a2968..68e784cdc0 100644 --- a/src/System.Management.Automation/logging/MshLog.cs +++ b/src/System.Management.Automation/logging/MshLog.cs @@ -134,7 +134,7 @@ namespace System.Management.Automation try { -#if !CORECLR //TODO:CORECLR EventLogLogProvider not handled yet +#if !CORECLR // TODO:CORECLR EventLogLogProvider not handled yet LogProvider eventLogLogProvider = new EventLogLogProvider(shellId); providers.Add(eventLogLogProvider); #endif @@ -1025,20 +1025,20 @@ namespace System.Management.Automation #region EventId Constants - //General health issues. + // General health issues. internal const int EVENT_ID_GENERAL_HEALTH_ISSUE = 100; // Dependency. resource not available internal const int EVENT_ID_RESOURCE_NOT_AVAILABLE = 101; - //Connectivity. network connection failure + // Connectivity. network connection failure internal const int EVENT_ID_NETWORK_CONNECTIVITY_ISSUE = 102; - //Settings. fail to set some configuration settings + // Settings. fail to set some configuration settings internal const int EVENT_ID_CONFIGURATION_FAILURE = 103; - //Performance. system is experiencing some performance issues + // Performance. system is experiencing some performance issues internal const int EVENT_ID_PERFORMANCE_ISSUE = 104; - //Security: system is experiencing some security issues + // Security: system is experiencing some security issues internal const int EVENT_ID_SECURITY_ISSUE = 105; - //Workload. system is overloaded. + // Workload. system is overloaded. internal const int EVENT_ID_SYSTEM_OVERLOADED = 106; // Beta 1 only -- Unexpected Exception diff --git a/src/System.Management.Automation/namespaces/FileSystemContentStream.cs b/src/System.Management.Automation/namespaces/FileSystemContentStream.cs index b980ccd2b8..51f2ba8ffe 100644 --- a/src/System.Management.Automation/namespaces/FileSystemContentStream.cs +++ b/src/System.Management.Automation/namespaces/FileSystemContentStream.cs @@ -394,7 +394,7 @@ namespace Microsoft.PowerShell.Commands (e is UnauthorizedAccessException) || (e is ArgumentNullException)) { - //Exception contains specific message about the error occured and so no need for errordetails. + // Exception contains specific message about the error occured and so no need for errordetails. _provider.WriteError(new ErrorRecord(e, "GetContentReaderIOError", ErrorCategory.ReadError, _path)); return null; } @@ -544,7 +544,7 @@ namespace Microsoft.PowerShell.Commands (e is UnauthorizedAccessException) || (e is ArgumentNullException)) { - //Exception contains specific message about the error occured and so no need for errordetails. + // Exception contains specific message about the error occured and so no need for errordetails. _provider.WriteError(new ErrorRecord(e, "GetContentReaderIOError", ErrorCategory.ReadError, _path)); } else diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index 201d3262d9..5217f35dc8 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -522,7 +522,7 @@ namespace Microsoft.PowerShell.Commands } else { - //error. + // error. ErrorRecord er = new ErrorRecord(new InvalidOperationException(FileSystemProviderStrings.InvalidDriveName), "DriveNameNotSupportedForPersistence", ErrorCategory.InvalidOperation, drive); ThrowTerminatingError(er); } @@ -1030,13 +1030,13 @@ namespace Microsoft.PowerShell.Commands /// protected override bool IsValidPath(string path) { - //Path passed should be fully qualified path. + // Path passed should be fully qualified path. if (string.IsNullOrEmpty(path)) { return false; } - //Normalize the path + // Normalize the path path = NormalizePath(path); path = EnsureDriveIsRooted(path); @@ -1051,7 +1051,7 @@ namespace Microsoft.PowerShell.Commands } #endif - //Make sure the path is either drive rooted or UNC Path + // Make sure the path is either drive rooted or UNC Path if (!IsAbsolutePath(path) && !IsUNCPath(path)) { return false; @@ -1201,7 +1201,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioError) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. ErrorRecord er = new ErrorRecord(ioError, "GetItemIOError", ErrorCategory.ReadError, path); WriteError(er); } @@ -1908,8 +1908,8 @@ namespace Microsoft.PowerShell.Commands newName = Path.GetFileName(newName); } - //Check to see if the target specified is just filename. We dont allow rename to move the file to a different directory. - //If a path is specified for the newName then we flag that as an error. + // Check to see if the target specified is just filename. We dont allow rename to move the file to a different directory. + // If a path is specified for the newName then we flag that as an error. if (string.Compare(Path.GetFileName(newName), newName, StringComparison.OrdinalIgnoreCase) != 0) { throw PSTraceSource.NewArgumentException("newName", FileSystemProviderStrings.RenameError); @@ -1987,7 +1987,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "RenameItemIOError", ErrorCategory.WriteError, path)); } catch (UnauthorizedAccessException accessException) @@ -2102,7 +2102,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException exception) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(exception, "NewItemIOError", ErrorCategory.WriteError, path)); } catch (UnauthorizedAccessException accessException) @@ -2160,7 +2160,7 @@ namespace Microsoft.PowerShell.Commands if (itemType == ItemType.HardLink) { - //Hard links can only be to files, not directories. + // Hard links can only be to files, not directories. if (isDirectory == true) { string message = StringUtil.Format(FileSystemProviderStrings.ItemNotFile, strTargetPath); @@ -2252,7 +2252,7 @@ namespace Microsoft.PowerShell.Commands #if UNIX if (Platform.Unix.GetErrorCategory(errorCode) == ErrorCategory.PermissionDenied) #else - if (errorCode == 1314) //ERROR_PRIVILEGE_NOT_HELD + if (errorCode == 1314) // ERROR_PRIVILEGE_NOT_HELD #endif { string message = FileSystemProviderStrings.ElevationRequired; @@ -2260,7 +2260,7 @@ namespace Microsoft.PowerShell.Commands return; } - if (errorCode == 1) //ERROR_INVALID_FUNCTION + if (errorCode == 1) // ERROR_INVALID_FUNCTION { string message = null; if (itemType == ItemType.SymbolicLink) @@ -2317,7 +2317,7 @@ namespace Microsoft.PowerShell.Commands return; } - //Junctions can only be directories. + // Junctions can only be directories. if (!isDirectory) { string message = StringUtil.Format(FileSystemProviderStrings.ItemNotDirectory, value); @@ -2342,7 +2342,7 @@ namespace Microsoft.PowerShell.Commands if (pathExists) { - //Junctions can only be directories. + // Junctions can only be directories. if (!isPathDirectory) { string message = StringUtil.Format(FileSystemProviderStrings.ItemNotDirectory, path); @@ -2350,7 +2350,7 @@ namespace Microsoft.PowerShell.Commands return; } - //Junctions cannot have files + // Junctions cannot have files if (DirectoryInfoHasChildItems((DirectoryInfo)pathDirInfo)) { string message = StringUtil.Format(FileSystemProviderStrings.DirectoryNotEmpty, path); @@ -2392,7 +2392,7 @@ namespace Microsoft.PowerShell.Commands { WriteItemObject(pathDirInfo, path, true); } - else //rollback the directory creation if we created it. + else // rollback the directory creation if we created it. { if (!pathExists) { @@ -2402,7 +2402,7 @@ namespace Microsoft.PowerShell.Commands } catch (Exception exception) { - //rollback the directory creation if it was created. + // rollback the directory creation if it was created. if (!pathExists) { pathDirInfo.Delete(); @@ -2564,7 +2564,7 @@ namespace Microsoft.PowerShell.Commands if (!Force) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "CreateDirectoryIOError", ErrorCategory.WriteError, path)); } } @@ -2641,7 +2641,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "CreateIntermediateDirectoriesIOError", ErrorCategory.WriteError, path)); } catch (UnauthorizedAccessException accessException) @@ -2784,7 +2784,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException exception) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(exception, "RemoveItemIOError", ErrorCategory.WriteError, path)); } catch (UnauthorizedAccessException accessException) @@ -2973,7 +2973,7 @@ namespace Microsoft.PowerShell.Commands fileSystemInfo != null, "Caller should always check fileSystemInfo"); - //First check if we can delete this file when force is not specified. + // First check if we can delete this file when force is not specified. if (!Force && (fileSystemInfo.Attributes & (FileAttributes.Hidden | FileAttributes.System | FileAttributes.ReadOnly)) != 0) { @@ -3629,7 +3629,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "CopyDirectoryInfoItemIOError", ErrorCategory.WriteError, file)); } catch (UnauthorizedAccessException accessException) @@ -3661,7 +3661,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "CopyDirectoryInfoItemIOError", ErrorCategory.WriteError, childDir)); } catch (UnauthorizedAccessException accessException) @@ -3690,7 +3690,7 @@ namespace Microsoft.PowerShell.Commands destinationPath = MakePath(destinationPath, file.Name); } - //if the source and destination path are same then flag it as error. + // if the source and destination path are same then flag it as error. if (InternalSymbolicLinkLinkCodeMethods.IsSameFileSystemItem(destinationPath, file.FullName)) { string error = StringUtil.Format(FileSystemProviderStrings.CopyError, destinationPath); @@ -4451,7 +4451,7 @@ namespace Microsoft.PowerShell.Commands Hashtable op = SafeInvokeCommand.Invoke(ps, this, null); if (op == null || op["BytesWritten"] == null) { - //write error to stream + // write error to stream Exception e = new IOException(string.Format(CultureInfo.InvariantCulture, FileSystemProviderStrings.CopyItemRemotelyFailed, file)); WriteError(new ErrorRecord(e, "CopyError", ErrorCategory.WriteError, file.FullName)); return false; @@ -4958,7 +4958,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioError) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioError, "NormalizeRelativePathIOError", ErrorCategory.ReadError, path)); break; } @@ -5317,7 +5317,7 @@ namespace Microsoft.PowerShell.Commands { // Pop the result and continue processing string poppedName = normalizedPathStack.Pop(); - //update our currentpath to reflect the change. + // update our currentpath to reflect the change. if (currentPath.Length > poppedName.Length) { currentPath = currentPath.Substring(0, currentPath.Length - poppedName.Length - 1); @@ -5616,7 +5616,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "MoveItemIOError", ErrorCategory.WriteError, path)); } catch (UnauthorizedAccessException accessException) @@ -5702,7 +5702,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //check if destination file exists. if force is specified then we should delete the destination before moving + // check if destination file exists. if force is specified then we should delete the destination before moving if (force && File.Exists(destination)) { FileInfo destfile = new FileInfo(destination); @@ -5710,7 +5710,7 @@ namespace Microsoft.PowerShell.Commands { try { - //Make sure the file is not read only + // Make sure the file is not read only destfile.Attributes = destfile.Attributes & ~(FileAttributes.ReadOnly | FileAttributes.Hidden); destfile.Delete(); file.MoveTo(destination); @@ -5732,7 +5732,7 @@ namespace Microsoft.PowerShell.Commands (exception is ArgumentNullException) || (exception is IOException)) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "MoveFileInfoItemIOError", ErrorCategory.WriteError, destfile)); } else @@ -5741,13 +5741,13 @@ namespace Microsoft.PowerShell.Commands } else { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "MoveFileInfoItemIOError", ErrorCategory.WriteError, file)); } } else { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "MoveFileInfoItemIOError", ErrorCategory.WriteError, file)); } } @@ -5835,7 +5835,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "MoveDirectoryItemIOError", ErrorCategory.WriteError, directory)); } } @@ -5977,7 +5977,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "GetPropertyIOError", ErrorCategory.ReadError, path)); } catch (UnauthorizedAccessException accessException) @@ -6282,7 +6282,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "ClearPropertyIOError", ErrorCategory.WriteError, path)); } } @@ -6455,7 +6455,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "GetContentReaderIOError", ErrorCategory.ReadError, path)); } catch (System.Security.SecurityException securityException) @@ -6589,7 +6589,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "GetContentWriterIOError", ErrorCategory.WriteError, path)); } catch (System.Security.SecurityException securityException) @@ -6742,7 +6742,7 @@ namespace Microsoft.PowerShell.Commands } catch (IOException ioException) { - //IOException contains specific message about the error occured and so no need for errordetails. + // IOException contains specific message about the error occured and so no need for errordetails. WriteError(new ErrorRecord(ioException, "ClearContentIOError", ErrorCategory.WriteError, path)); } catch (UnauthorizedAccessException accessException) @@ -6760,7 +6760,7 @@ namespace Microsoft.PowerShell.Commands FileStream fileStream = new FileStream(path, FileMode.Truncate, FileAccess.Write, FileShare.Write); fileStream.Dispose(); - //For filesystem once content is cleared + // For filesystem once content is cleared WriteItemObject(string.Empty, path, false); } catch (UnauthorizedAccessException failure) @@ -6916,7 +6916,7 @@ namespace Microsoft.PowerShell.Commands [DllImport("mpr.dll", CharSet = CharSet.Unicode)] internal static extern int WNetGetConnection(string localName, StringBuilder remoteName, ref int remoteNameLength); -#if CORECLR //TODO:CORECLR Win32 function 'PathIsNetworkPath' is in an extension API set which is currently not on CSS. +#if CORECLR // TODO:CORECLR Win32 function 'PathIsNetworkPath' is in an extension API set which is currently not on CSS. /// /// Searches a path for a drive letter within the range of 'A' to 'Z' and returns the corresponding drive number. /// @@ -7504,7 +7504,7 @@ namespace Microsoft.PowerShell.Commands /// public static class InternalSymbolicLinkLinkCodeMethods { - //This size comes from measuring the size of the header of REPARSE_GUID_DATA_BUFFER + // This size comes from measuring the size of the header of REPARSE_GUID_DATA_BUFFER private const int REPARSE_GUID_DATA_BUFFER_HEADER_SIZE = 24; // Maximum reparse buffer info size. The max user defined reparse @@ -7526,7 +7526,7 @@ namespace Microsoft.PowerShell.Commands private const string NonInterpretedPathPrefix = @"\??\"; [Flags] - //dwDesiredAccess of CreateFile + // dwDesiredAccess of CreateFile internal enum FileDesiredAccess : uint { GenericRead = 0x80000000, @@ -7536,7 +7536,7 @@ namespace Microsoft.PowerShell.Commands } [Flags] - //dwShareMode of CreateFile + // dwShareMode of CreateFile internal enum FileShareMode : uint { None = 0x00000000, @@ -7545,7 +7545,7 @@ namespace Microsoft.PowerShell.Commands Delete = 0x00000004, } - //dwCreationDisposition of CreateFile + // dwCreationDisposition of CreateFile internal enum FileCreationDisposition : uint { New = 1, @@ -7556,7 +7556,7 @@ namespace Microsoft.PowerShell.Commands } [Flags] - //dwFlagsAndAttributes + // dwFlagsAndAttributes internal enum FileAttributes : uint { Readonly = 0x00000001, @@ -7721,7 +7721,7 @@ namespace Microsoft.PowerShell.Commands throw new Win32Exception(Marshal.GetLastWin32Error()); } -#elif !CORECLR //FindFirstFileName, FindNextFileName and FindClose are not available on Core Clr +#elif !CORECLR // FindFirstFileName, FindNextFileName and FindClose are not available on Core Clr UInt32 linkStringLength = 0; var linkName = new StringBuilder(); @@ -7749,11 +7749,11 @@ namespace Microsoft.PowerShell.Commands do { StringBuilder fullName = new StringBuilder(); - fullName.Append(Path.GetPathRoot(filePath)); //hard link source and target must be on the same drive. So we can use the source for find the path root. + fullName.Append(Path.GetPathRoot(filePath)); // hard link source and target must be on the same drive. So we can use the source for find the path root. fullName.Append(linkName.ToString()); FileInfo fInfo = new FileInfo(fullName.ToString()); - //Don't add the target link to the list. + // Don't add the target link to the list. if (string.Compare(fInfo.FullName, filePath, StringComparison.OrdinalIgnoreCase) != 0) links.Add(fInfo.FullName); @@ -7768,7 +7768,7 @@ namespace Microsoft.PowerShell.Commands continueFind = InternalSymbolicLinkLinkCodeMethods.FindNextFileName(fileHandle, ref linkStringLength, linkName); } - if (!continueFind && lastError != 38) //ERROR_HANDLE_EOF. No more links. + if (!continueFind && lastError != 38) // ERROR_HANDLE_EOF. No more links. { throw new Win32Exception(lastError); } @@ -7815,12 +7815,12 @@ namespace Microsoft.PowerShell.Commands int bytesReturned; string linkType = null; - //OACR warning 62001 about using DeviceIOControl has been disabled. + // OACR warning 62001 about using DeviceIOControl has been disabled. // According to MSDN guidance DangerousAddRef() and DangerousRelease() have been used. handle.DangerousAddRef(ref success); - //Get Buffer size + // Get Buffer size IntPtr dangerousHandle = handle.DangerousGetHandle(); bool result = DeviceIoControl(dangerousHandle, FSCTL_GET_REPARSE_POINT, @@ -8027,7 +8027,7 @@ namespace Microsoft.PowerShell.Commands { int bytesReturned; - //OACR warning 62001 about using DeviceIOControl has been disabled. + // OACR warning 62001 about using DeviceIOControl has been disabled. // According to MSDN guidance DangerousAddRef() and DangerousRelease() have been used. handle.DangerousAddRef(ref success); @@ -8044,7 +8044,7 @@ namespace Microsoft.PowerShell.Commands throw new Win32Exception(lastError); } - //Unmarshal to symbolic link to look for tags. + // Unmarshal to symbolic link to look for tags. REPARSE_DATA_BUFFER_SYMBOLICLINK reparseDataBuffer = Marshal.PtrToStructure(outBuffer); if (reparseDataBuffer.ReparseTag != IO_REPARSE_TAG_SYMLINK && reparseDataBuffer.ReparseTag != IO_REPARSE_TAG_MOUNT_POINT) @@ -8059,7 +8059,7 @@ namespace Microsoft.PowerShell.Commands if (reparseDataBuffer.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { - //Since this is a junction we need to unmarshal to the correct structure. + // Since this is a junction we need to unmarshal to the correct structure. REPARSE_DATA_BUFFER_MOUNTPOINT reparseDataBufferMountPoint = Marshal.PtrToStructure(outBuffer); targetDir = Encoding.Unicode.GetString(reparseDataBufferMountPoint.PathBuffer, reparseDataBufferMountPoint.SubstituteNameOffset, reparseDataBufferMountPoint.SubstituteNameLength); @@ -8108,12 +8108,12 @@ namespace Microsoft.PowerShell.Commands REPARSE_DATA_BUFFER_MOUNTPOINT mountPoint = new REPARSE_DATA_BUFFER_MOUNTPOINT(); mountPoint.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; - mountPoint.ReparseDataLength = (ushort)(mountPointBytes.Length + 12); //Added space for the header and null endo + mountPoint.ReparseDataLength = (ushort)(mountPointBytes.Length + 12); // Added space for the header and null endo mountPoint.SubstituteNameOffset = 0; mountPoint.SubstituteNameLength = (ushort)mountPointBytes.Length; mountPoint.PrintNameOffset = (ushort)(mountPointBytes.Length + 2); // 2 as unicode null take 2 bytes. mountPoint.PrintNameLength = 0; - mountPoint.PathBuffer = new byte[0x3FF0]; //Buffer for max size. + mountPoint.PathBuffer = new byte[0x3FF0]; // Buffer for max size. Array.Copy(mountPointBytes, mountPoint.PathBuffer, mountPointBytes.Length); int nativeBufferSize = Marshal.SizeOf(mountPoint); @@ -8126,7 +8126,7 @@ namespace Microsoft.PowerShell.Commands int bytesReturned = 0; - //OACR warning 62001 about using DeviceIOControl has been disabled. + // OACR warning 62001 about using DeviceIOControl has been disabled. // According to MSDN guidance DangerousAddRef() and DangerousRelease() have been used. handle.DangerousAddRef(ref success); diff --git a/src/System.Management.Automation/namespaces/RegistryProvider.cs b/src/System.Management.Automation/namespaces/RegistryProvider.cs index 3a0e48555d..a74be7af3b 100644 --- a/src/System.Management.Automation/namespaces/RegistryProvider.cs +++ b/src/System.Management.Automation/namespaces/RegistryProvider.cs @@ -47,7 +47,7 @@ namespace Microsoft.PowerShell.Commands /// The third parameter states the capabilities of the provider. /// /// --> -#if CORECLR //System.Transaction namespace is not in CoreClr. +#if CORECLR // System.Transaction namespace is not in CoreClr. [CmdletProvider(RegistryProvider.ProviderName, ProviderCapabilities.ShouldProcess)] #else [CmdletProvider(RegistryProvider.ProviderName, ProviderCapabilities.ShouldProcess | ProviderCapabilities.Transactions)] @@ -3934,7 +3934,7 @@ namespace Microsoft.PowerShell.Commands } catch (System.ArgumentException) { - //RegistryKey that contains the specified value does not exist + // RegistryKey that contains the specified value does not exist } catch (System.IO.IOException) { diff --git a/src/System.Management.Automation/namespaces/RegistrySecurity.cs b/src/System.Management.Automation/namespaces/RegistrySecurity.cs index afb9eaa129..c528c3b513 100644 --- a/src/System.Management.Automation/namespaces/RegistrySecurity.cs +++ b/src/System.Management.Automation/namespaces/RegistrySecurity.cs @@ -177,7 +177,7 @@ namespace Microsoft.PowerShell.Commands } else { - return new RegistrySecurity(); //sections); + return new RegistrySecurity(); // sections); } } @@ -203,7 +203,7 @@ namespace Microsoft.PowerShell.Commands } else { - return new RegistrySecurity(); //sections); + return new RegistrySecurity(); // sections); } } diff --git a/src/System.Management.Automation/namespaces/TransactedRegistry.cs b/src/System.Management.Automation/namespaces/TransactedRegistry.cs index a0cf6fc851..ea293cc857 100644 --- a/src/System.Management.Automation/namespaces/TransactedRegistry.cs +++ b/src/System.Management.Automation/namespaces/TransactedRegistry.cs @@ -21,7 +21,7 @@ namespace Microsoft.PowerShell.Commands.Internal * * @security(checkClassLinking=on) */ - //This class contains only static members and does not need to be serializable. + // This class contains only static members and does not need to be serializable. [ComVisible(true)] // Suppressed because these objects need to be accessed from CmdLets. [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] diff --git a/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs b/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs index 92a68ea005..330b157f7a 100644 --- a/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs +++ b/src/System.Management.Automation/namespaces/TransactedRegistryKey.cs @@ -301,7 +301,7 @@ namespace Microsoft.PowerShell.Commands.Internal } catch (TransactionException) { - //ignore. + // ignore. } finally { @@ -1291,7 +1291,7 @@ namespace Microsoft.PowerShell.Commands.Internal data = new String[strings.Count]; strings.CopyTo((String[])data, 0); - //data = strings.GetAllItems(String.class); + // data = strings.GetAllItems(String.class); } break; @@ -1671,19 +1671,19 @@ namespace Microsoft.PowerShell.Commands.Internal case Win32Native.ERROR_INVALID_HANDLE: // ** - //* For normal RegistryKey instances we dispose the SafeRegHandle and throw IOException. - //* However, for HKEY_PERFORMANCE_DATA (on a local or remote machine) we avoid disposing the - //* SafeRegHandle and only throw the IOException. This is to workaround reentrancy issues - //* in PerformanceCounter.NextValue() where the API could throw {NullReference, ObjectDisposed, ArgumentNull}Exception - //* on reentrant calls because of this error code path in RegistryKey - //* - //* Normally we'd make our caller synchronize access to a shared RegistryKey instead of doing something like this, - //* however we shipped PerformanceCounter.NextValue() un-synchronized in v2.0RTM and customers have taken a dependency on - //* this behavior (being able to simultaneously query multiple remote-machine counters on multiple threads, instead of - //* having serialized access). - //* - //* FUTURE: Consider changing PerformanceCounterLib to handle its own Win32 RegistryKey API calls instead of depending - //* on Microsoft.Win32.RegistryKey, so that RegistryKey can be clean of special-cases for HKEY_PERFORMANCE_DATA. + // * For normal RegistryKey instances we dispose the SafeRegHandle and throw IOException. + // * However, for HKEY_PERFORMANCE_DATA (on a local or remote machine) we avoid disposing the + // * SafeRegHandle and only throw the IOException. This is to workaround reentrancy issues + // * in PerformanceCounter.NextValue() where the API could throw {NullReference, ObjectDisposed, ArgumentNull}Exception + // * on reentrant calls because of this error code path in RegistryKey + // * + // * Normally we'd make our caller synchronize access to a shared RegistryKey instead of doing something like this, + // * however we shipped PerformanceCounter.NextValue() un-synchronized in v2.0RTM and customers have taken a dependency on + // * this behavior (being able to simultaneously query multiple remote-machine counters on multiple threads, instead of + // * having serialized access). + // * + // * FUTURE: Consider changing PerformanceCounterLib to handle its own Win32 RegistryKey API calls instead of depending + // * on Microsoft.Win32.RegistryKey, so that RegistryKey can be clean of special-cases for HKEY_PERFORMANCE_DATA. // _hkey.SetHandleAsInvalid(); _hkey = null; diff --git a/src/System.Management.Automation/security/Authenticode.cs b/src/System.Management.Automation/security/Authenticode.cs index f5a8ffe239..642e3aac13 100644 --- a/src/System.Management.Automation/security/Authenticode.cs +++ b/src/System.Management.Automation/security/Authenticode.cs @@ -151,7 +151,7 @@ namespace System.Management.Automation } SecuritySupport.CheckIfFileExists(fileName); - //SecurityUtils.CheckIfFileSmallerThan4Bytes(fileName); + // SecurityUtils.CheckIfFileSmallerThan4Bytes(fileName); try { @@ -442,7 +442,7 @@ namespace System.Management.Automation { Utils.CheckArgForNullOrEmpty(fileName, "fileName"); SecuritySupport.CheckIfFileExists(fileName); - //SecurityUtils.CheckIfFileSmallerThan4Bytes(fileName); + // SecurityUtils.CheckIfFileSmallerThan4Bytes(fileName); } try diff --git a/src/System.Management.Automation/security/CatalogHelper.cs b/src/System.Management.Automation/security/CatalogHelper.cs index 8a2cae31cc..d20511d7f8 100644 --- a/src/System.Management.Automation/security/CatalogHelper.cs +++ b/src/System.Management.Automation/security/CatalogHelper.cs @@ -217,7 +217,7 @@ namespace System.Management.Automation if (dirInfo != null) { - //Relative path of the file is the path inside the containing folder excluding folder Name + // Relative path of the file is the path inside the containing folder excluding folder Name relativePath = fileToHash.FullName.Substring(dirInfo.FullName.Length).TrimStart('\\'); } else @@ -612,7 +612,7 @@ namespace System.Management.Automation if (dirInfo != null) { - //Relative path of the file is the path inside the containing folder excluding folder Name + // Relative path of the file is the path inside the containing folder excluding folder Name relativePath = fileToHash.FullName.Substring(dirInfo.FullName.Length).TrimStart('\\'); exclude = fileToHash.Name; } @@ -703,7 +703,7 @@ namespace System.Management.Automation List relativePathsNotInFolder = relativePathsFromFolder.Except(relativePathsFromCatalog, StringComparer.CurrentCultureIgnoreCase).ToList(); List relativePathsNotInCatalog = relativePathsFromCatalog.Except(relativePathsFromFolder, StringComparer.CurrentCultureIgnoreCase).ToList(); - //Found extra hashes in Folder + // Found extra hashes in Folder if ((relativePathsNotInFolder.Count != 0) || (relativePathsNotInCatalog.Count != 0)) { Status = false; diff --git a/src/System.Management.Automation/security/MshSignature.cs b/src/System.Management.Automation/security/MshSignature.cs index 4ba0b83840..122a3f2c44 100644 --- a/src/System.Management.Automation/security/MshSignature.cs +++ b/src/System.Management.Automation/security/MshSignature.cs @@ -106,7 +106,7 @@ namespace System.Management.Automation private X509Certificate2 _signerCert; private string _statusMessage = string.Empty; private X509Certificate2 _timeStamperCert; - //private DateTime signedOn = new DateTime(0); + // private DateTime signedOn = new DateTime(0); // Three states: // - True: we can rely on the catalog API to check catalog signature. diff --git a/src/System.Management.Automation/security/SecurityManager.cs b/src/System.Management.Automation/security/SecurityManager.cs index 006ca44f00..6f447d8ae4 100644 --- a/src/System.Management.Automation/security/SecurityManager.cs +++ b/src/System.Management.Automation/security/SecurityManager.cs @@ -66,7 +66,7 @@ namespace Microsoft.PowerShell // execution policy that dictates what can run in msh private ExecutionPolicy _executionPolicy; - //shellId supplied by runspace configuration + // shellId supplied by runspace configuration private string _shellId; /// diff --git a/src/System.Management.Automation/security/nativeMethods.cs b/src/System.Management.Automation/security/nativeMethods.cs index 73c7c1a108..a2940821ea 100644 --- a/src/System.Management.Automation/security/nativeMethods.cs +++ b/src/System.Management.Automation/security/nativeMethods.cs @@ -579,15 +579,15 @@ namespace System.Management.Automation.Security internal enum SignInfoSubjectChoice { CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_FILE = 0x01 - //CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_BLOB = 0x02 NotUsed + // CRYPTUI_WIZ_DIGITAL_SIGN_SUBJECT_BLOB = 0x02 NotUsed }; [Flags] internal enum SignInfoCertChoice { CRYPTUI_WIZ_DIGITAL_SIGN_CERT = 0x01 - //CRYPTUI_WIZ_DIGITAL_SIGN_STORE = 0x02, NotUsed - //CRYPTUI_WIZ_DIGITAL_SIGN_PVK = 0x03, NotUsed + // CRYPTUI_WIZ_DIGITAL_SIGN_STORE = 0x02, NotUsed + // CRYPTUI_WIZ_DIGITAL_SIGN_PVK = 0x03, NotUsed }; [Flags] @@ -891,10 +891,10 @@ namespace System.Management.Automation.Security internal enum WintrustUnionChoice { WTD_CHOICE_FILE = 1, - //WTD_CHOICE_CATALOG = 2, + // WTD_CHOICE_CATALOG = 2, WTD_CHOICE_BLOB = 3, - //WTD_CHOICE_SIGNER = 4, - //WTD_CHOICE_CERT = 5, + // WTD_CHOICE_SIGNER = 4, + // WTD_CHOICE_CERT = 5, }; [Flags] @@ -1221,8 +1221,8 @@ namespace System.Management.Automation.Security internal struct CERT_ENHKEY_USAGE { internal DWORD cUsageIdentifier; - //[MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr, SizeParamIndex=0)] - //internal string[] rgpszUsageIdentifier; // LPSTR* + // [MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr, SizeParamIndex=0)] + // internal string[] rgpszUsageIdentifier; // LPSTR* internal IntPtr rgpszUsageIdentifier; }; diff --git a/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs b/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs index c39d35864c..09e5cddae6 100644 --- a/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs +++ b/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs @@ -46,7 +46,7 @@ namespace System.Management.Automation /// internal const string MshSnapinKey = "PowerShellSnapIns"; - //Name of various values for each mshsnapin + // Name of various values for each mshsnapin internal const string MshSnapin_ApplicationBase = "ApplicationBase"; internal const string MshSnapin_AssemblyName = "AssemblyName"; internal const string MshSnapin_ModuleName = "ModuleName"; @@ -60,7 +60,7 @@ namespace System.Management.Automation internal const string MshSnapin_VendorResource = "VendorIndirect"; internal const string MshSnapin_LogPipelineExecutionDetails = "LogPipelineExecutionDetails"; - //Name of default mshsnapins + // Name of default mshsnapins internal const string CoreMshSnapinName = "Microsoft.PowerShell.Core"; internal const string HostMshSnapinName = "Microsoft.PowerShell.Host"; internal const string ManagementMshSnapinName = "Microsoft.PowerShell.Management"; @@ -508,7 +508,7 @@ namespace System.Management.Automation { continue; } - //found a key which is not version + // found a key which is not version if (!MeetsVersionFormat(version)) { continue; @@ -519,8 +519,8 @@ namespace System.Management.Automation { oneVersionMshSnapins = ReadAll(monadRootKey, version); } - //If we cannot get information for one version, continue with other - //versions + // If we cannot get information for one version, continue with other + // versions catch (SecurityException) { } @@ -606,7 +606,7 @@ namespace System.Management.Automation RegistryKey versionRoot = GetVersionRootKey(monadRootKey, psVersion); RegistryKey mshsnapinRoot = GetMshSnapinRootKey(versionRoot, psVersion); - //get name of all mshsnapin for this version + // get name of all mshsnapin for this version string[] mshsnapinIds = mshsnapinRoot.GetSubKeyNames(); foreach (string id in mshsnapinIds) @@ -620,7 +620,7 @@ namespace System.Management.Automation { mshsnapins.Add(ReadOne(mshsnapinRoot, id)); } - //If we cannot read some mshsnapins, we should continue + // If we cannot read some mshsnapins, we should continue catch (SecurityException) { } @@ -772,7 +772,7 @@ namespace System.Management.Automation if (msv == null) { - //Check if the value is in string format + // Check if the value is in string format string singleValue = value as string; if (singleValue != null) { @@ -1125,9 +1125,9 @@ namespace System.Management.Automation RegistryKey rootKey = Registry.LocalMachine.OpenSubKey(RegistryStrings.MonadRootKeyPath); if (rootKey == null) { - //This should never occur because this code is running - //because monad is installed. { well this can occur if someone - //deletes the registry key after starting monad + // This should never occur because this code is running + // because monad is installed. { well this can occur if someone + // deletes the registry key after starting monad Dbg.Assert(false, "Root Key of Monad installation is not present"); throw PSTraceSource.NewArgumentException("monad", MshSnapinInfo.MonadRootRegistryAccessFailed); } diff --git a/src/System.Management.Automation/utils/CryptoUtils.cs b/src/System.Management.Automation/utils/CryptoUtils.cs index 49f66895df..00785621ec 100644 --- a/src/System.Management.Automation/utils/CryptoUtils.cs +++ b/src/System.Management.Automation/utils/CryptoUtils.cs @@ -45,8 +45,8 @@ namespace System.Management.Automation.Internal /// Class the encapsulates native crypto key handles and provides a /// mechanism to release resources used by it. /// - //[SecurityPermission(SecurityAction.Demand, UnmanagedCode=true)] - //[SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)] + // [SecurityPermission(SecurityAction.Demand, UnmanagedCode=true)] + // [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)] internal class PSSafeCryptKey : SafeHandleZeroOrMinusOneIsInvalid { /// @@ -532,7 +532,7 @@ namespace System.Management.Automation.Internal /// and encoded as a base 64 string. internal string SafeExportSessionKey() { - //generate one if not already done. + // generate one if not already done. GenerateSessionKey(); uint length = 0; @@ -855,7 +855,7 @@ namespace System.Management.Automation.Internal System.GC.SuppressFinalize(this); } - //[SecurityPermission(SecurityAction.Demand, UnmanagedCode=true)] + // [SecurityPermission(SecurityAction.Demand, UnmanagedCode=true)] protected void Dispose(bool disposing) { if (disposing) @@ -1199,14 +1199,14 @@ namespace System.Management.Automation.Internal { ServerRemoteSession session = Session as ServerRemoteSession; - //session!=null check required for DRTs TestEncryptSecureString* entries in CryptoUtilsTest/UTUtils.dll - //for newer clients, server will never initiate key exchange. - //for server, just the session key is required to encrypt/decrypt anything + // session!=null check required for DRTs TestEncryptSecureString* entries in CryptoUtilsTest/UTUtils.dll + // for newer clients, server will never initiate key exchange. + // for server, just the session key is required to encrypt/decrypt anything if ((session != null) && (session.Context.ClientCapability.ProtocolVersion >= RemotingConstants.ProtocolVersionWin8RTM)) { _rsaCryptoProvider.GenerateSessionKey(); } - else //older clients + else // older clients { RunKeyExchangeIfRequired(); } @@ -1231,7 +1231,7 @@ namespace System.Management.Automation.Internal Dbg.Assert(!string.IsNullOrEmpty(publicKeyAsString), "public key passed in cannot be null"); // generate the crypto provider to use for encryption - //_rsaCryptoProvider = GenerateCryptoServiceProvider(false); + // _rsaCryptoProvider = GenerateCryptoServiceProvider(false); try { @@ -1316,7 +1316,7 @@ namespace System.Management.Automation.Internal { _rsaCryptoProvider = PSRSACryptoServiceProvider.GetRSACryptoServiceProviderForClient(); - //_session = new RemoteSession(); + // _session = new RemoteSession(); } #endregion Constructors diff --git a/src/System.Management.Automation/utils/PSTelemetryWrapper.cs b/src/System.Management.Automation/utils/PSTelemetryWrapper.cs index 56440f148c..5a15dbb943 100644 --- a/src/System.Management.Automation/utils/PSTelemetryWrapper.cs +++ b/src/System.Management.Automation/utils/PSTelemetryWrapper.cs @@ -121,7 +121,7 @@ namespace System.Management.Automation.Internal // "data": { // "PSVersion": "5.0" // } - //} + // } public static void TraceMessage(string message, T arguments) { diff --git a/src/System.Management.Automation/utils/PlatformInvokes.cs b/src/System.Management.Automation/utils/PlatformInvokes.cs index 5a1422adae..87cd3d0deb 100644 --- a/src/System.Management.Automation/utils/PlatformInvokes.cs +++ b/src/System.Management.Automation/utils/PlatformInvokes.cs @@ -48,10 +48,10 @@ namespace System.Management.Automation internal FILETIME ftCreationTime; internal FILETIME ftLastAccessTime; internal FILETIME ftLastWriteTime; - internal uint nFileSizeHigh; //changed all to uint, otherwise you run into unexpected overflow - internal uint nFileSizeLow; //| - internal uint dwReserved0; //| - internal uint dwReserved1; //v + internal uint nFileSizeHigh; // changed all to uint, otherwise you run into unexpected overflow + internal uint nFileSizeLow; // | + internal uint dwReserved0; // | + internal uint dwReserved1; // v [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH)] internal string cFileName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_ALTERNATE)] @@ -68,7 +68,7 @@ namespace System.Management.Automation internal static extern bool FindClose(IntPtr hFindFile); [Flags] - //dwDesiredAccess of CreateFile + // dwDesiredAccess of CreateFile internal enum FileDesiredAccess : uint { GenericRead = 0x80000000, @@ -78,7 +78,7 @@ namespace System.Management.Automation } [Flags] - //dwShareMode of CreateFile + // dwShareMode of CreateFile internal enum FileShareMode : uint { None = 0x00000000, @@ -87,7 +87,7 @@ namespace System.Management.Automation Delete = 0x00000004, } - //dwCreationDisposition of CreateFile + // dwCreationDisposition of CreateFile internal enum FileCreationDisposition : uint { New = 1, @@ -98,7 +98,7 @@ namespace System.Management.Automation } [Flags] - //dwFlagsAndAttributes + // dwFlagsAndAttributes internal enum FileAttributes : uint { ReadOnly = 0x00000001, @@ -267,7 +267,7 @@ namespace System.Management.Automation /// [DllImport(PinvokeDllNames.CloseHandleDllName, SetLastError = true)]//, ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [return: MarshalAs(UnmanagedType.Bool)] - //[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] + // [SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] internal static extern bool CloseHandle(IntPtr handle); [DllImport(PinvokeDllNames.DosDateTimeToFileTimeDllName, SetLastError = false)] diff --git a/src/System.Management.Automation/utils/PowerShellETWTracer.cs b/src/System.Management.Automation/utils/PowerShellETWTracer.cs index a043a213e9..cfea7b4ac9 100644 --- a/src/System.Management.Automation/utils/PowerShellETWTracer.cs +++ b/src/System.Management.Automation/utils/PowerShellETWTracer.cs @@ -10,7 +10,7 @@ using System.Management.Automation.Internal; namespace System.Management.Automation.Tracing { - //pragma warning disable 16001,16003 + // pragma warning disable 16001,16003 #region Constants /// @@ -385,7 +385,7 @@ namespace System.Management.Automation.Tracing /// /// Defines enumerations for channels. /// - //pragma warning disable 16001 + // pragma warning disable 16001 public enum PowerShellTraceChannel { /// @@ -407,7 +407,7 @@ namespace System.Management.Automation.Tracing /// Debug = 0x12, } - //pragma warning restore 16001 + // pragma warning restore 16001 /// /// Define enumerations for levels. @@ -1533,7 +1533,7 @@ namespace System.Management.Automation.Tracing return new PowerShellTraceSource(task, keywords); } } - //pragma warning restore 16001,16003 + // pragma warning restore 16001,16003 } #endif diff --git a/src/System.Management.Automation/utils/PowerShellExecutionHelper.cs b/src/System.Management.Automation/utils/PowerShellExecutionHelper.cs index 7faebd1291..35e6af08a5 100644 --- a/src/System.Management.Automation/utils/PowerShellExecutionHelper.cs +++ b/src/System.Management.Automation/utils/PowerShellExecutionHelper.cs @@ -113,7 +113,7 @@ namespace System.Management.Automation try { // blocks until all results are retrieved. - //results = this.ExecuteCommand(cmd); + // results = this.ExecuteCommand(cmd); // If this pipeline has been stopped lets set a flag to cancel all future tab completion calls // untill the next completion diff --git a/src/System.Management.Automation/utils/PsUtils.cs b/src/System.Management.Automation/utils/PsUtils.cs index 287944d843..422e634228 100644 --- a/src/System.Management.Automation/utils/PsUtils.cs +++ b/src/System.Management.Automation/utils/PsUtils.cs @@ -600,31 +600,31 @@ namespace System.Management.Automation string decoded = new string(Encoding.Unicode.GetChars(Convert.FromBase64String(base64))); - //Deserialize string + // Deserialize string XmlReader reader = XmlReader.Create(new StringReader(decoded), InternalDeserializer.XmlReaderSettingsForCliXml); object dso; Deserializer deserializer = new Deserializer(reader); dso = deserializer.Deserialize(); if (deserializer.Done() == false) { - //This helper function should move to host and it should provide appropriate - //error message there. + // This helper function should move to host and it should provide appropriate + // error message there. throw PSTraceSource.NewArgumentException(MinishellParameterBinderController.ArgsParameter); } PSObject mo = dso as PSObject; if (mo == null) { - //This helper function should move the host. Provide appropriate error message. - //Format of args parameter is not correct. + // This helper function should move the host. Provide appropriate error message. + // Format of args parameter is not correct. throw PSTraceSource.NewArgumentException(MinishellParameterBinderController.ArgsParameter); } var argsList = mo.BaseObject as ArrayList; if (argsList == null) { - //This helper function should move the host. Provide appropriate error message. - //Format of args parameter is not correct. + // This helper function should move the host. Provide appropriate error message. + // Format of args parameter is not correct. throw PSTraceSource.NewArgumentException(MinishellParameterBinderController.ArgsParameter); } diff --git a/src/System.Management.Automation/utils/Verbs.cs b/src/System.Management.Automation/utils/Verbs.cs index 3a94789215..ac45f3fc54 100644 --- a/src/System.Management.Automation/utils/Verbs.cs +++ b/src/System.Management.Automation/utils/Verbs.cs @@ -1198,7 +1198,7 @@ namespace System.Management.Automation s_recommendedAlternateVerbs.Add("configure", new string[] { "Set" }); s_recommendedAlternateVerbs.Add("create", new string[] { "New" }); s_recommendedAlternateVerbs.Add("cut", new string[] { "Remove" }); - //recommendedAlternateVerbs.Add("debug", new string[] {"Ping"}); + // recommendedAlternateVerbs.Add("debug", new string[] {"Ping"}); s_recommendedAlternateVerbs.Add("delete", new string[] { "Remove" }); s_recommendedAlternateVerbs.Add("detach", new string[] { "Dismount", "Remove" }); s_recommendedAlternateVerbs.Add("determine", new string[] { "Measure", "Resolve" }); @@ -1224,7 +1224,7 @@ namespace System.Management.Automation s_recommendedAlternateVerbs.Add("flush", new string[] { "Clear" }); s_recommendedAlternateVerbs.Add("follow", new string[] { "Trace" }); s_recommendedAlternateVerbs.Add("generate", new string[] { "New" }); - //recommendedAlternateVerbs.Add("get", new string[] {"Read"}); + // recommendedAlternateVerbs.Add("get", new string[] {"Read"}); s_recommendedAlternateVerbs.Add("halt", new string[] { "Disable" }); s_recommendedAlternateVerbs.Add("in", new string[] { "ConvertTo" }); s_recommendedAlternateVerbs.Add("index", new string[] { "Update" }); @@ -1245,18 +1245,18 @@ namespace System.Management.Automation s_recommendedAlternateVerbs.Add("name", new string[] { "Move" }); s_recommendedAlternateVerbs.Add("nullify", new string[] { "Clear" }); s_recommendedAlternateVerbs.Add("obtain", new string[] { "Get" }); - //recommendedAlternateVerbs.Add("out", new string[] {"ConvertFrom"}); + // recommendedAlternateVerbs.Add("out", new string[] {"ConvertFrom"}); s_recommendedAlternateVerbs.Add("output", new string[] { "ConvertFrom" }); s_recommendedAlternateVerbs.Add("pause", new string[] { "Suspend", "Wait" }); s_recommendedAlternateVerbs.Add("peek", new string[] { "Receive" }); s_recommendedAlternateVerbs.Add("permit", new string[] { "Enable" }); s_recommendedAlternateVerbs.Add("purge", new string[] { "Clear", "Remove" }); s_recommendedAlternateVerbs.Add("pick", new string[] { "Select" }); - //recommendedAlternateVerbs.Add("pop", new string[] {"Enter", "Exit"}); + // recommendedAlternateVerbs.Add("pop", new string[] {"Enter", "Exit"}); s_recommendedAlternateVerbs.Add("prevent", new string[] { "Block" }); s_recommendedAlternateVerbs.Add("print", new string[] { "Write" }); s_recommendedAlternateVerbs.Add("prompt", new string[] { "Read" }); - //recommendedAlternateVerbs.Add("push", new string[] {"Enter", "Exit"}); + // recommendedAlternateVerbs.Add("push", new string[] {"Enter", "Exit"}); s_recommendedAlternateVerbs.Add("put", new string[] { "Send", "Write" }); s_recommendedAlternateVerbs.Add("puts", new string[] { "Write" }); s_recommendedAlternateVerbs.Add("quota", new string[] { "Limit" }); @@ -1270,15 +1270,15 @@ namespace System.Management.Automation s_recommendedAlternateVerbs.Add("renew", new string[] { "Initialize", "Update" }); s_recommendedAlternateVerbs.Add("replicate", new string[] { "Copy" }); s_recommendedAlternateVerbs.Add("resample", new string[] { "Convert" }); - //recommendedAlternateVerbs.Add("reset", new string[] {"Set"}); - //recommendedAlternateVerbs.Add("resize", new string[] {"Convert"}); + // recommendedAlternateVerbs.Add("reset", new string[] {"Set"}); + // recommendedAlternateVerbs.Add("resize", new string[] {"Convert"}); s_recommendedAlternateVerbs.Add("restrict", new string[] { "Lock" }); s_recommendedAlternateVerbs.Add("return", new string[] { "Repair", "Restore" }); s_recommendedAlternateVerbs.Add("revert", new string[] { "Unpublish" }); s_recommendedAlternateVerbs.Add("revise", new string[] { "Edit" }); s_recommendedAlternateVerbs.Add("run", new string[] { "Invoke", "Start" }); s_recommendedAlternateVerbs.Add("salvage", new string[] { "Test" }); - //recommendedAlternateVerbs.Add("save", new string[] {"Backup"}); + // recommendedAlternateVerbs.Add("save", new string[] {"Backup"}); s_recommendedAlternateVerbs.Add("secure", new string[] { "Lock" }); s_recommendedAlternateVerbs.Add("separate", new string[] { "Split" }); s_recommendedAlternateVerbs.Add("setup", new string[] { "Initialize", "Install" }); @@ -1289,7 +1289,7 @@ namespace System.Management.Automation s_recommendedAlternateVerbs.Add("track", new string[] { "Trace" }); s_recommendedAlternateVerbs.Add("transfer", new string[] { "Move" }); s_recommendedAlternateVerbs.Add("type", new string[] { "Get" }); - //recommendedAlternateVerbs.Add("undo", new string[] {"Repair", "Restore"}); + // recommendedAlternateVerbs.Add("undo", new string[] {"Repair", "Restore"}); s_recommendedAlternateVerbs.Add("unite", new string[] { "Join", "Merge" }); s_recommendedAlternateVerbs.Add("unlink", new string[] { "Dismount" }); s_recommendedAlternateVerbs.Add("unmark", new string[] { "Clear" });