diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs index 93b8272e5..4d2ee3550 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs @@ -28,6 +28,7 @@ namespace Microsoft.PowerShell.Commands [Alias("ClassName")] [Parameter(Position = 0, Mandatory = true, ParameterSetName = "query")] [Parameter(Position = 1, ParameterSetName = "list")] + [ValidateNotNullOrEmpty()] public string Class { get; set; } /// @@ -40,6 +41,7 @@ namespace Microsoft.PowerShell.Commands /// The WMI properties to retrieve /// [Parameter(Position = 1, ParameterSetName = "query")] + [ValidateNotNullOrEmpty()] public string[] Property { get { return (string[])_property.Clone(); } diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs index 2df654759..ff54523da 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs @@ -4747,6 +4747,7 @@ namespace Microsoft.PowerShell.Commands /// /// [Parameter(Position = 0, ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty()] public string[] PSProvider { get { return _provider; } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/EnableDisableRunspaceDebugCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/EnableDisableRunspaceDebugCommand.cs index e071d4140..cd9010bfa 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/EnableDisableRunspaceDebugCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/EnableDisableRunspaceDebugCommand.cs @@ -132,6 +132,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(Position = 0, ParameterSetName = CommonRunspaceCommandBase.RunspaceNameParameterSet)] + [ValidateNotNullOrEmpty()] [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public string[] RunspaceName { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-PSBreakpoint.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-PSBreakpoint.cs index 013e9a82e..463b95b21 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-PSBreakpoint.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Get-PSBreakpoint.cs @@ -41,7 +41,7 @@ namespace Microsoft.PowerShell.Commands [Parameter(ParameterSetName = "Variable")] [Parameter(ParameterSetName = "Command")] [Parameter(ParameterSetName = "Type")] - [ValidateNotNull] + [ValidateNotNullOrEmpty()] public string[] Script { get diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventCommand.cs index 3521745a7..0989e91f9 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventCommand.cs @@ -21,6 +21,7 @@ namespace Microsoft.PowerShell.Commands /// An identifier for this event subscription /// [Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = "BySource")] + [ValidateNotNullOrEmpty()] public string SourceIdentifier { get diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventSubscriberCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventSubscriberCommand.cs index d6c920b03..7c013c30a 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventSubscriberCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetEventSubscriberCommand.cs @@ -21,6 +21,7 @@ namespace Microsoft.PowerShell.Commands /// An identifier for this event subscription /// [Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = "BySource")] + [ValidateNotNullOrEmpty()] public string SourceIdentifier { get diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRunspaceCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRunspaceCommand.cs index 21a524b6f..f138b9dd8 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRunspaceCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetRunspaceCommand.cs @@ -34,6 +34,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter(Position = 0, ParameterSetName = GetRunspaceCommand.NameParameterSet)] + [ValidateNotNullOrEmpty()] [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public string[] Name { diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs index 7c3238eb6..e44ed52a6 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Var.cs @@ -258,7 +258,7 @@ namespace Microsoft.PowerShell.Commands /// Name of the PSVariable /// [Parameter(Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] - [ValidateNotNull] + [ValidateNotNullOrEmpty()] public string[] Name { get diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/GetTracerCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/GetTracerCommand.cs index d17f34422..12465f079 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/GetTracerCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/trace/GetTracerCommand.cs @@ -22,6 +22,7 @@ namespace Microsoft.PowerShell.Commands /// /// [Parameter(Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty()] public string[] Name { get diff --git a/src/Microsoft.PowerShell.Security/security/CredentialCommands.cs b/src/Microsoft.PowerShell.Security/security/CredentialCommands.cs index 2ff2acb43..3b07aac60 100644 --- a/src/Microsoft.PowerShell.Security/security/CredentialCommands.cs +++ b/src/Microsoft.PowerShell.Security/security/CredentialCommands.cs @@ -56,6 +56,7 @@ namespace Microsoft.PowerShell.Commands /// Gets and sets the user supplied username to be used while creating the PSCredential. /// [Parameter(Position = 0, Mandatory = false, ParameterSetName = messageSet)] + [ValidateNotNullOrEmpty()] public string UserName { get { return _userName; } diff --git a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs index e03727ed3..2a79d55ce 100644 --- a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs +++ b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs @@ -2824,6 +2824,7 @@ $args[0] | foreach {{ /// [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] [Parameter(Position = 0, Mandatory = false)] + [ValidateNotNullOrEmpty()] public string[] Name { get; set; } /// diff --git a/src/System.Management.Automation/help/HelpCommands.cs b/src/System.Management.Automation/help/HelpCommands.cs index 36550fd5f..461f221f3 100644 --- a/src/System.Management.Automation/help/HelpCommands.cs +++ b/src/System.Management.Automation/help/HelpCommands.cs @@ -51,6 +51,7 @@ namespace Microsoft.PowerShell.Commands /// Target to search for help /// [Parameter(Position = 0, ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty()] public string Name { get; set; } = ""; /// diff --git a/src/System.Management.Automation/singleshell/Commands/MshSnapinCommands.cs b/src/System.Management.Automation/singleshell/Commands/MshSnapinCommands.cs index 34ebd2848..439150781 100644 --- a/src/System.Management.Automation/singleshell/Commands/MshSnapinCommands.cs +++ b/src/System.Management.Automation/singleshell/Commands/MshSnapinCommands.cs @@ -712,6 +712,7 @@ namespace Microsoft.PowerShell.Commands /// Name(s) of PSSnapIn(s). /// [Parameter(Position = 0, Mandatory = false)] + [ValidateNotNullOrEmpty()] public string[] Name { get