diff --git a/.globalconfig b/.globalconfig index f6683fcab6..74af40cc68 100644 --- a/.globalconfig +++ b/.globalconfig @@ -1162,7 +1162,7 @@ dotnet_diagnostic.SA1120.severity = none dotnet_diagnostic.SA1121.severity = none # SA1122: Use string.Empty for empty strings -dotnet_diagnostic.SA1122.severity = none +dotnet_diagnostic.SA1122.severity = warning # SA1123: Do not place regions within elements dotnet_diagnostic.SA1123.severity = none diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs index 023fc1d050..fc32e3edd3 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs @@ -137,7 +137,7 @@ namespace Microsoft.PowerShell.Commands /// Run a command. /// protected void RunCommand(String command, String args) { - String cmd = ""; + String cmd = string.Empty; _process = new Process() { diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs index 35697db56b..0851f233a5 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs @@ -233,7 +233,7 @@ namespace Microsoft.PowerShell.Commands catch (ArgumentException) { WriteNonTerminatingError( - "", + string.Empty, processId, processId, null, diff --git a/src/Microsoft.WSMan.Management/ConfigProvider.cs b/src/Microsoft.WSMan.Management/ConfigProvider.cs index 3b0251d09f..a4c6ad1db7 100644 --- a/src/Microsoft.WSMan.Management/ConfigProvider.cs +++ b/src/Microsoft.WSMan.Management/ConfigProvider.cs @@ -1284,7 +1284,7 @@ namespace Microsoft.WSMan.Management { if (!Force) { - string query = ""; + string query = string.Empty; string caption = helper.GetResourceMsgFromResourcetext("SetItemGeneralSecurityCaption"); if (ChildName.Equals("TrustedHosts", StringComparison.OrdinalIgnoreCase)) { diff --git a/src/System.Management.Automation/engine/CommandCompletion/ExtensibleCompletion.cs b/src/System.Management.Automation/engine/CommandCompletion/ExtensibleCompletion.cs index 6905e39b16..665dee5c8c 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/ExtensibleCompletion.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/ExtensibleCompletion.cs @@ -129,7 +129,7 @@ namespace System.Management.Automation if (CommandName == null || CommandName.Length == 0) { - CommandName = new[] { "" }; + CommandName = new[] { string.Empty }; } for (int i = 0; i < CommandName.Length; i++) diff --git a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs index dbd52e080b..fdd907103c 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs @@ -2345,7 +2345,7 @@ namespace Microsoft.PowerShell.Commands key: "FileList", manifestProcessingFlags, moduleBase, - extension: "", + extension: string.Empty, // Don't check file existence - don't want to change current behavior without feature team discussion. verifyFilesExist: false, out List fileList)) diff --git a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs index 61f391dd35..b79eb4d6fd 100644 --- a/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs +++ b/src/System.Management.Automation/engine/hostifaces/LocalPipeline.cs @@ -249,7 +249,7 @@ namespace System.Management.Automation.Runspaces } default: - Debug.Fail(""); + Debug.Fail(string.Empty); break; } } 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 fc011b313e..69eb742057 100644 --- a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs +++ b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs @@ -2236,7 +2236,7 @@ namespace System.Management.Automation } else { - module = new string[] { "" }; + module = new string[] { string.Empty }; } ModuleSpecification[] fullyQualifiedName = null; diff --git a/src/powershell/Program.cs b/src/powershell/Program.cs index 732b4db588..edac5b24f0 100644 --- a/src/powershell/Program.cs +++ b/src/powershell/Program.cs @@ -320,7 +320,7 @@ namespace Microsoft.PowerShell // // Since command_name is ignored and we can't use null (it's the terminator) // we use empty string - execArgs[4] = ""; + execArgs[4] = string.Empty; // Add the arguments passed to pwsh on the end. args.CopyTo(execArgs, 5);