From f9d49088ca99a428ba5f39145317a7ec8802f850 Mon Sep 17 00:00:00 2001
From: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
Date: Tue, 2 Sep 2025 19:25:05 +0100
Subject: [PATCH] Fix `SA1028`: Code should not contain trailing whitespace
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md
---
.../ManagementList/ColumnPicker.xaml.cs | 2 +-
.../cmdletization/cim/CimJobException.cs | 2 +-
.../cimSupport/cmdletization/cim/cimQuery.cs | 2 +-
.../commands/management/CIMHelper.cs | 2 +-
.../commands/management/Eventlog.cs | 4 +-
.../management/GetComputerInfoCommand.cs | 2 +-
.../commands/management/ResolvePathCommand.cs | 2 +-
.../commands/management/TestPathCommand.cs | 2 +-
.../commands/management/WebServiceProxy.cs | 2 +-
.../commands/utility/CsvCommands.cs | 10 ++---
.../commands/utility/Import-LocalizedData.cs | 2 +-
.../commands/utility/Measure-Object.cs | 2 +-
.../commands/utility/New-Object.cs | 4 +-
.../commands/utility/NewGuidCommand.cs | 2 +-
.../commands/utility/StartSleepCommand.cs | 2 +-
.../Common/HttpVersionCompletionsAttribute.cs | 2 +-
.../utility/WebCmdlet/ConvertToJsonCommand.cs | 2 +-
.../utility/WebCmdlet/CoreCLR/WebProxy.cs | 2 +-
.../utility/trace/TraceExpressionCommand.cs | 2 +-
.../WindowsTaskbarJumpList/HResult.cs | 12 +++---
.../host/msh/Executor.cs | 2 +-
.../host/msh/StopTranscriptCmdlet.cs | 2 +-
src/Microsoft.WSMan.Management/CredSSP.cs | 2 +-
.../DscSupport/CimDSCParser.cs | 2 +-
.../common/DisplayDatabase/FormatTable.cs | 2 +-
...lets-over-objects.xmlSerializer.autogen.cs | 2 +-
.../CommandCompletion/CompletionAnalysis.cs | 4 +-
.../CommandCompletion/CompletionCompleters.cs | 14 +++----
.../CommandCompletion/CompletionHelpers.cs | 6 +--
.../engine/CommandPathSearch.cs | 2 +-
.../engine/CommandSearcher.cs | 2 +-
.../engine/EventManager.cs | 2 +-
.../engine/GetCommandCommand.cs | 2 +-
.../engine/LanguagePrimitives.cs | 4 +-
.../engine/Modules/GetModuleCommand.cs | 2 +-
.../engine/Modules/ModuleCmdletBase.cs | 4 +-
.../engine/NativeCommandParameterBinder.cs | 4 +-
.../engine/debugger/debugger.cs | 6 +--
.../engine/hostifaces/LocalConnection.cs | 4 +-
.../engine/hostifaces/PSTask.cs | 2 +-
.../engine/hostifaces/Pipeline.cs | 2 +-
.../engine/hostifaces/PowerShell.cs | 8 ++--
.../engine/hostifaces/RunspacePool.cs | 2 +-
.../engine/hostifaces/RunspacePoolInternal.cs | 2 +-
.../engine/regex.cs | 4 +-
.../engine/runtime/ScriptBlockToPowerShell.cs | 14 +++----
.../namespaces/RegistryProvider.cs | 2 +-
.../config/MshSnapinLoadException.cs | 2 +-
.../utils/CommandDiscoveryExceptions.cs | 6 +--
.../utils/CommandProcessorExceptions.cs | 2 +-
.../utils/ExecutionExceptions.cs | 42 +++++++++----------
.../utils/HostInterfacesExceptions.cs | 6 +--
.../utils/MshArgumentException.cs | 2 +-
.../utils/MshArgumentNullException.cs | 4 +-
.../utils/MshArgumentOutOfRangeException.cs | 4 +-
.../utils/MshInvalidOperationException.cs | 2 +-
.../utils/MshNotImplementedException.cs | 4 +-
.../utils/MshNotSupportedException.cs | 4 +-
.../utils/ParameterBinderExceptions.cs | 12 +++---
.../utils/RuntimeException.cs | 4 +-
.../EtwActivityReverterMethodInvoker.cs | 2 +-
.../utils/tracing/PSEtwLogProvider.cs | 2 +-
test/perf/benchmarks/Engine.Compiler.cs | 2 +-
.../BenchmarkDotNet.Extensions/Extensions.cs | 4 +-
.../PartitionFilter.cs | 6 +--
.../TooManyTestCasesValidator.cs | 6 +--
.../UniqueArgumentsValidator.cs | 2 +-
.../ValuesGenerator.cs | 8 ++--
test/perf/dotnet-tools/Reporting/Reporter.cs | 8 ++--
.../dotnet-tools/ResultsComparer/Program.cs | 2 +-
.../assets/ExpTest/ExpTest.cs | 2 +-
test/xUnit/csharp/test_CryptoUtils.cs | 2 +-
test/xUnit/csharp/test_FileSystemProvider.cs | 2 +-
test/xUnit/csharp/test_PSConfiguration.cs | 2 +-
74 files changed, 155 insertions(+), 155 deletions(-)
diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs
index 8a919959968..05151330ea2 100644
--- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs
+++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs
@@ -60,7 +60,7 @@ internal ColumnPicker(
: this()
{
ArgumentNullException.ThrowIfNull(columns);
-
+
ArgumentNullException.ThrowIfNull(availableColumns);
// Add visible columns to Selected list, preserving order
diff --git a/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/CimJobException.cs b/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/CimJobException.cs
index 675c6c71404..935cc960c6c 100644
--- a/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/CimJobException.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/CimJobException.cs
@@ -49,7 +49,7 @@ public CimJobException(string message, Exception inner) : base(message, inner)
///
/// The that holds the serialized object data about the exception being thrown.
/// The that contains contextual information about the source or destination.
- [Obsolete("Legacy serialization support is deprecated since .NET 8", DiagnosticId = "SYSLIB0051")]
+ [Obsolete("Legacy serialization support is deprecated since .NET 8", DiagnosticId = "SYSLIB0051")]
protected CimJobException(
SerializationInfo info,
StreamingContext context)
diff --git a/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimQuery.cs b/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimQuery.cs
index a065f79204f..155e7aa3ef8 100644
--- a/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimQuery.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimQuery.cs
@@ -315,7 +315,7 @@ public override void FilterByAssociatedInstance(object associatedInstance, strin
public override void AddQueryOption(string optionName, object optionValue)
{
ArgumentException.ThrowIfNullOrEmpty(optionName);
- ArgumentNullException.ThrowIfNull(optionValue);
+ ArgumentNullException.ThrowIfNull(optionValue);
this.queryOptions[optionName] = optionValue;
}
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/CIMHelper.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/CIMHelper.cs
index 035d5b17bbe..688b6362e16 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/CIMHelper.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/CIMHelper.cs
@@ -132,7 +132,7 @@ internal static string WqlQueryAll(string from)
internal static T[] GetAll(CimSession session, string nameSpace, string wmiClassName) where T : class, new()
{
ArgumentException.ThrowIfNullOrEmpty(wmiClassName);
-
+
var rv = new List();
try
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs
index 3731687599c..9695ccd5546 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs
@@ -555,7 +555,7 @@ private bool FiltersMatch(EventLogEntry entry)
}
}
- if (!usernamematch)
+ if (!usernamematch)
{
return usernamematch;
}
@@ -595,7 +595,7 @@ private bool FiltersMatch(EventLogEntry entry)
}
}
- if (!datematch)
+ if (!datematch)
{
return datematch;
}
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs
index 3de7c723745..e858d14127f 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs
@@ -3685,7 +3685,7 @@ public enum DeviceGuardHardwareSecure
/// Secure Memory Overwrite.
///
SecureMemoryOverwrite = 4,
-
+
///
/// UEFI Code Readonly.
///
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs
index 3d1b66933d2..d0f5fecf495 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs
@@ -81,7 +81,7 @@ public SwitchParameter Relative
///
[Parameter]
public string RelativeBasePath
- {
+ {
get
{
return _relativeBasePath;
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestPathCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestPathCommand.cs
index d8748b6ef9c..50765c0e0ae 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TestPathCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TestPathCommand.cs
@@ -200,7 +200,7 @@ protected override void ProcessRecord()
{
WriteObject(result);
}
-
+
continue;
}
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs
index 3fc313fe222..3f91d597e57 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/WebServiceProxy.cs
@@ -475,7 +475,7 @@ private object InstantiateWebServiceProxy(Assembly assembly)
break;
}
- if (proxyType != null)
+ if (proxyType != null)
{
break;
}
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs
index 6297d9b1f38..c8bb4991c59 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CsvCommands.cs
@@ -959,7 +959,7 @@ internal static IList BuildPropertyNames(PSObject source, IList
/// Converted string.
internal string ConvertPropertyNamesCSV(IList propertyNames)
{
- ArgumentNullException.ThrowIfNull(propertyNames);
+ ArgumentNullException.ThrowIfNull(propertyNames);
_outputString.Clear();
bool first = true;
@@ -994,7 +994,7 @@ internal string ConvertPropertyNamesCSV(IList propertyNames)
AppendStringWithEscapeAlways(_outputString, propertyName);
break;
case BaseCsvWritingCommand.QuoteKind.AsNeeded:
-
+
if (propertyName.AsSpan().IndexOfAny(_delimiter, '\n', '"') != -1)
{
AppendStringWithEscapeAlways(_outputString, propertyName);
@@ -1023,7 +1023,7 @@ internal string ConvertPropertyNamesCSV(IList propertyNames)
///
internal string ConvertPSObjectToCSV(PSObject mshObject, IList propertyNames)
{
- ArgumentNullException.ThrowIfNull(propertyNames);
+ ArgumentNullException.ThrowIfNull(propertyNames);
_outputString.Clear();
bool first = true;
@@ -1109,7 +1109,7 @@ internal string ConvertPSObjectToCSV(PSObject mshObject, IList propertyN
/// ToString() value.
internal static string GetToStringValueForProperty(PSPropertyInfo property)
{
- ArgumentNullException.ThrowIfNull(property);
+ ArgumentNullException.ThrowIfNull(property);
string value = null;
try
@@ -1271,7 +1271,7 @@ internal class ImportCsvHelper
internal ImportCsvHelper(PSCmdlet cmdlet, char delimiter, IList header, string typeName, StreamReader streamReader)
{
- ArgumentNullException.ThrowIfNull(cmdlet);
+ ArgumentNullException.ThrowIfNull(cmdlet);
ArgumentNullException.ThrowIfNull(streamReader);
_cmdlet = cmdlet;
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Import-LocalizedData.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Import-LocalizedData.cs
index 1f43670531d..c4e423ffd1d 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Import-LocalizedData.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Import-LocalizedData.cs
@@ -158,7 +158,7 @@ protected override void ProcessRecord()
ThrowTerminatingError(
new ErrorRecord(nse, "CannotDefineSupportedCommand", ErrorCategory.PermissionDenied, null));
}
-
+
SystemPolicy.LogWDACAuditMessage(
context: Context,
title: ImportLocalizedDataStrings.WDACLogTitle,
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs
index cf483b16a93..1e741758270 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs
@@ -824,7 +824,7 @@ protected override void EndProcessing()
string errorId = (IsMeasuringGeneric) ? "GenericMeasurePropertyNotFound" : "TextMeasurePropertyNotFound";
WritePropertyNotFoundError(propertyName, errorId);
}
-
+
continue;
}
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 f2c31faf400..0ea312f2963 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/New-Object.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/New-Object.cs
@@ -196,12 +196,12 @@ protected override void BeginProcessing()
{
ThrowTerminatingError(
new ErrorRecord(
- new PSNotSupportedException(NewObjectStrings.CannotCreateTypeConstrainedLanguage),
+ new PSNotSupportedException(NewObjectStrings.CannotCreateTypeConstrainedLanguage),
"CannotCreateTypeConstrainedLanguage",
ErrorCategory.PermissionDenied,
targetObject: null));
}
-
+
SystemPolicy.LogWDACAuditMessage(
context: Context,
title: NewObjectStrings.TypeWDACLogTitle,
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewGuidCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewGuidCommand.cs
index 3aa070bcd62..6cf6f19e8e0 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewGuidCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewGuidCommand.cs
@@ -45,7 +45,7 @@ protected override void ProcessRecord()
{
ErrorRecord error = new(ex, "StringNotRecognizedAsGuid", ErrorCategory.InvalidArgument, null);
WriteError(error);
- }
+ }
}
else
{
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs
index df1c8b76fb8..839a0b7c051 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/StartSleepCommand.cs
@@ -110,7 +110,7 @@ protected override void ProcessRecord()
case "Milliseconds":
sleepTime = Milliseconds;
break;
-
+
case "FromTimeSpan":
if (Duration.TotalMilliseconds > int.MaxValue)
{
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/HttpVersionCompletionsAttribute.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/HttpVersionCompletionsAttribute.cs
index 05eb8ed96b6..903ff4d8f80 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/HttpVersionCompletionsAttribute.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/HttpVersionCompletionsAttribute.cs
@@ -46,6 +46,6 @@ static HttpVersionCompletionsAttribute()
///
public HttpVersionCompletionsAttribute() : base(AllowedVersions)
{
- }
+ }
}
}
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertToJsonCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertToJsonCommand.cs
index eb8c3e3cc08..173d999b06d 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertToJsonCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/ConvertToJsonCommand.cs
@@ -98,7 +98,7 @@ protected virtual void Dispose(bool disposing)
_cancellationSource.Dispose();
}
}
-
+
private readonly List