From 01b3f04f88879f10d70c16f2bb47852c3f964352 Mon Sep 17 00:00:00 2001
From: filzrev <103790468+filzrev@users.noreply.github.com>
Date: Sat, 28 Jun 2025 12:37:40 +0900
Subject: [PATCH 1/3] chore: replace stylecop to unstable package
---
build/common.props | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/build/common.props b/build/common.props
index b3e5fa2561..b33bc4d863 100644
--- a/build/common.props
+++ b/build/common.props
@@ -65,8 +65,9 @@
all
runtime; build; native; contentfiles; analyzers
-
+
all
+ runtime; build; native; contentfiles; analyzers
From 97de36146503f53722fa5f01f76aa8a359c284a1 Mon Sep 17 00:00:00 2001
From: filzrev <103790468+filzrev@users.noreply.github.com>
Date: Sat, 28 Jun 2025 12:39:25 +0900
Subject: [PATCH 2/3] chore: fix target-typed new statement spacing that raise
SA1000 errors by stylecop
---
.../JitStatsDiagnoser.cs | 6 ++---
.../BenchmarkExecutor.cs | 2 +-
.../Remoting/BenchmarkExecutorWrapper.cs | 2 +-
.../VSTestEventProcessor.cs | 6 ++---
.../Columns/StatisticalTestColumn.cs | 4 ++--
.../ConsoleArguments/ConfigParser.cs | 2 +-
.../Detectors/Cpu/HardwareIntrinsics.cs | 2 +-
src/BenchmarkDotNet/Detectors/CpuDetector.cs | 4 ++--
src/BenchmarkDotNet/Detectors/OsDetector.cs | 4 ++--
.../Diagnosers/PerfCollectProfiler.cs | 8 +++----
.../Disassemblers/Arm64Disassembler.cs | 2 +-
.../Arm64InstructionFormatter.cs | 2 +-
.../Disassemblers/IntelDisassembler.cs | 2 +-
.../SameArchitectureDisassembler.cs | 2 +-
src/BenchmarkDotNet/Engines/Engine.cs | 6 ++---
.../Engines/EngineActualStage.cs | 4 ++--
.../Engines/EngineWarmupStage.cs | 4 ++--
.../Environments/HostEnvironmentInfo.cs | 2 +-
.../Environments/Runtimes/CoreRuntime.cs | 22 +++++++++----------
.../Environments/Runtimes/MonoRuntime.cs | 12 +++++-----
src/BenchmarkDotNet/Helpers/AwaitHelper.cs | 2 +-
src/BenchmarkDotNet/Helpers/UnitHelper.cs | 2 +-
src/BenchmarkDotNet/Helpers/XUnitHelper.cs | 2 +-
src/BenchmarkDotNet/Jobs/EnvironmentMode.cs | 2 +-
src/BenchmarkDotNet/Jobs/RunMode.cs | 2 +-
src/BenchmarkDotNet/Loggers/Broker.cs | 4 ++--
src/BenchmarkDotNet/Models/BdnSchema.cs | 2 +-
src/BenchmarkDotNet/Order/CategoryComparer.cs | 2 +-
.../Properties/BenchmarkDotNetInfo.cs | 4 ++--
.../Running/BenchmarkRunnerClean.cs | 4 ++--
.../Toolchains/DotNetCli/DotNetCliCommand.cs | 4 ++--
.../DotNetCli/DotNetCliCommandExecutor.cs | 2 +-
.../Toolchains/DotNetCli/DotNetCliExecutor.cs | 8 +++----
.../DotNetCli/NetCoreAppSettings.cs | 22 +++++++++----------
src/BenchmarkDotNet/Toolchains/Executor.cs | 12 +++++-----
.../Toolchains/MonoWasm/WasmExecutor.cs | 4 ++--
.../Validators/ParamsValidator.cs | 2 +-
.../AllSetupAndCleanupTest.cs | 4 ++--
.../AsyncBenchmarksTests.cs | 6 ++---
.../CustomEngineTests.cs | 4 ++--
.../InProcessEmitTest.cs | 2 +-
.../MemoryDiagnoserTests.cs | 4 ++--
.../Builders/HostEnvironmentInfoBuilder.cs | 4 ++--
tests/BenchmarkDotNet.Tests/KnownIssue.cs | 2 +-
.../Mocks/Toolchain/MockToolchain.cs | 2 +-
.../Order/DefaultOrdererTests.cs | 4 ++--
.../Perfonar/Infra/PerfonarMock.cs | 2 +-
.../Perfonar/PerfonarTests.cs | 2 +-
.../Validators/ExecutionValidatorTests.cs | 4 ++--
49 files changed, 109 insertions(+), 109 deletions(-)
diff --git a/src/BenchmarkDotNet.Diagnostics.Windows/JitStatsDiagnoser.cs b/src/BenchmarkDotNet.Diagnostics.Windows/JitStatsDiagnoser.cs
index a101888a0e..b5d8a9c359 100644
--- a/src/BenchmarkDotNet.Diagnostics.Windows/JitStatsDiagnoser.cs
+++ b/src/BenchmarkDotNet.Diagnostics.Windows/JitStatsDiagnoser.cs
@@ -60,7 +60,7 @@ protected override void AttachToEvents(TraceEventSession session, BenchmarkCase
private sealed class MethodsJittedDescriptor : IMetricDescriptor
{
- internal static readonly MethodsJittedDescriptor Instance = new ();
+ internal static readonly MethodsJittedDescriptor Instance = new();
public string Id => nameof(MethodsJittedDescriptor);
public string DisplayName => "Methods JITted";
@@ -75,7 +75,7 @@ private sealed class MethodsJittedDescriptor : IMetricDescriptor
private sealed class MethodsTieredDescriptor : IMetricDescriptor
{
- internal static readonly MethodsTieredDescriptor Instance = new ();
+ internal static readonly MethodsTieredDescriptor Instance = new();
public string Id => nameof(MethodsTieredDescriptor);
public string DisplayName => "Methods Tiered";
@@ -90,7 +90,7 @@ private sealed class MethodsTieredDescriptor : IMetricDescriptor
private sealed class JitAllocatedMemoryDescriptor : IMetricDescriptor
{
- internal static readonly JitAllocatedMemoryDescriptor Instance = new ();
+ internal static readonly JitAllocatedMemoryDescriptor Instance = new();
public string Id => nameof(JitAllocatedMemoryDescriptor);
public string DisplayName => "JIT allocated memory";
diff --git a/src/BenchmarkDotNet.TestAdapter/BenchmarkExecutor.cs b/src/BenchmarkDotNet.TestAdapter/BenchmarkExecutor.cs
index dc3e7ee832..aad574ed76 100644
--- a/src/BenchmarkDotNet.TestAdapter/BenchmarkExecutor.cs
+++ b/src/BenchmarkDotNet.TestAdapter/BenchmarkExecutor.cs
@@ -15,7 +15,7 @@ namespace BenchmarkDotNet.TestAdapter
///
internal class BenchmarkExecutor
{
- private readonly CancellationTokenSource cts = new ();
+ private readonly CancellationTokenSource cts = new();
///
/// Runs all the benchmarks in the given assembly, updating the TestExecutionRecorder as they get run.
diff --git a/src/BenchmarkDotNet.TestAdapter/Remoting/BenchmarkExecutorWrapper.cs b/src/BenchmarkDotNet.TestAdapter/Remoting/BenchmarkExecutorWrapper.cs
index 646ae2f8be..28444ae8db 100644
--- a/src/BenchmarkDotNet.TestAdapter/Remoting/BenchmarkExecutorWrapper.cs
+++ b/src/BenchmarkDotNet.TestAdapter/Remoting/BenchmarkExecutorWrapper.cs
@@ -8,7 +8,7 @@ namespace BenchmarkDotNet.TestAdapter.Remoting
///
internal class BenchmarkExecutorWrapper : MarshalByRefObject
{
- private readonly BenchmarkExecutor benchmarkExecutor = new ();
+ private readonly BenchmarkExecutor benchmarkExecutor = new();
public void RunBenchmarks(string assemblyPath, TestExecutionRecorderWrapper recorder, HashSet? benchmarkIds = null)
{
diff --git a/src/BenchmarkDotNet.TestAdapter/VSTestEventProcessor.cs b/src/BenchmarkDotNet.TestAdapter/VSTestEventProcessor.cs
index 35438d4d80..f002e7eb29 100644
--- a/src/BenchmarkDotNet.TestAdapter/VSTestEventProcessor.cs
+++ b/src/BenchmarkDotNet.TestAdapter/VSTestEventProcessor.cs
@@ -25,9 +25,9 @@ internal class VsTestEventProcessor : EventProcessor
private readonly Dictionary cases;
private readonly TestExecutionRecorderWrapper recorder;
private readonly CancellationToken cancellationToken;
- private readonly Stopwatch runTimerStopwatch = new ();
- private readonly Dictionary testResults = new ();
- private readonly HashSet sentTestResults = new ();
+ private readonly Stopwatch runTimerStopwatch = new();
+ private readonly Dictionary testResults = new();
+ private readonly HashSet sentTestResults = new();
public VsTestEventProcessor(
List cases,
diff --git a/src/BenchmarkDotNet/Columns/StatisticalTestColumn.cs b/src/BenchmarkDotNet/Columns/StatisticalTestColumn.cs
index 51edbb40f9..52a95bc04e 100644
--- a/src/BenchmarkDotNet/Columns/StatisticalTestColumn.cs
+++ b/src/BenchmarkDotNet/Columns/StatisticalTestColumn.cs
@@ -15,9 +15,9 @@ public class StatisticalTestColumn(Threshold threshold, SignificanceLevel? signi
{
private static readonly SignificanceLevel DefaultSignificanceLevel = SignificanceLevel.P1E5;
- public static StatisticalTestColumn CreateDefault() => new (new PercentValue(10).ToThreshold());
+ public static StatisticalTestColumn CreateDefault() => new(new PercentValue(10).ToThreshold());
- public static StatisticalTestColumn Create(Threshold threshold, SignificanceLevel? significanceLevel = null) => new (threshold, significanceLevel);
+ public static StatisticalTestColumn Create(Threshold threshold, SignificanceLevel? significanceLevel = null) => new(threshold, significanceLevel);
public static StatisticalTestColumn Create(string threshold, SignificanceLevel? significanceLevel = null)
{
diff --git a/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs b/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs
index 9448dc409d..ac61ddb5f1 100644
--- a/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs
+++ b/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs
@@ -95,7 +95,7 @@ public static (bool isSuccess, IConfig config, CommandLineOptions options) Parse
private static (bool Success, string[] ExpandedTokens) ExpandResponseFile(string[] args, ILogger logger)
{
- List result = new ();
+ List result = new();
foreach (var arg in args)
{
if (arg.StartsWith("@"))
diff --git a/src/BenchmarkDotNet/Detectors/Cpu/HardwareIntrinsics.cs b/src/BenchmarkDotNet/Detectors/Cpu/HardwareIntrinsics.cs
index a8c7655272..265143a356 100644
--- a/src/BenchmarkDotNet/Detectors/Cpu/HardwareIntrinsics.cs
+++ b/src/BenchmarkDotNet/Detectors/Cpu/HardwareIntrinsics.cs
@@ -97,7 +97,7 @@ static IEnumerable GetCurrentProcessInstructionSets(Platform platform)
private static string GetShortAvx512Representation()
{
- StringBuilder avx512 = new ("AVX-512F");
+ StringBuilder avx512 = new("AVX-512F");
if (IsX86Avx512CDSupported) avx512.Append("+CD");
if (IsX86Avx512BWSupported) avx512.Append("+BW");
if (IsX86Avx512DQSupported) avx512.Append("+DQ");
diff --git a/src/BenchmarkDotNet/Detectors/CpuDetector.cs b/src/BenchmarkDotNet/Detectors/CpuDetector.cs
index 73d371a9fa..0cb583a95a 100644
--- a/src/BenchmarkDotNet/Detectors/CpuDetector.cs
+++ b/src/BenchmarkDotNet/Detectors/CpuDetector.cs
@@ -11,12 +11,12 @@ namespace BenchmarkDotNet.Detectors;
public class CpuDetector(params ICpuDetector[] detectors) : ICpuDetector
{
- public static CpuDetector CrossPlatform => new (
+ public static CpuDetector CrossPlatform => new(
new WindowsCpuDetector(),
new LinuxCpuDetector(),
new MacOsCpuDetector());
- private static readonly Lazy LazyCpu = new (() => CrossPlatform.Detect());
+ private static readonly Lazy LazyCpu = new(() => CrossPlatform.Detect());
public static CpuInfo? Cpu => LazyCpu.Value;
public bool IsApplicable() => detectors.Any(loader => loader.IsApplicable());
diff --git a/src/BenchmarkDotNet/Detectors/OsDetector.cs b/src/BenchmarkDotNet/Detectors/OsDetector.cs
index 6d47db1d4a..5deeea03a6 100644
--- a/src/BenchmarkDotNet/Detectors/OsDetector.cs
+++ b/src/BenchmarkDotNet/Detectors/OsDetector.cs
@@ -13,13 +13,13 @@ namespace BenchmarkDotNet.Detectors;
public class OsDetector
{
- public static readonly OsDetector Instance = new ();
+ public static readonly OsDetector Instance = new();
private OsDetector() { }
internal static string ExecutableExtension => IsWindows() ? ".exe" : string.Empty;
internal static string ScriptFileExtension => IsWindows() ? ".bat" : ".sh";
- private readonly Lazy os = new (ResolveOs);
+ private readonly Lazy os = new(ResolveOs);
public static OsInfo GetOs() => Instance.os.Value;
private static OsInfo ResolveOs()
diff --git a/src/BenchmarkDotNet/Diagnosers/PerfCollectProfiler.cs b/src/BenchmarkDotNet/Diagnosers/PerfCollectProfiler.cs
index f1b584ce09..9a3d348665 100644
--- a/src/BenchmarkDotNet/Diagnosers/PerfCollectProfiler.cs
+++ b/src/BenchmarkDotNet/Diagnosers/PerfCollectProfiler.cs
@@ -32,8 +32,8 @@ public class PerfCollectProfiler : IProfiler
private readonly PerfCollectProfilerConfig config;
private readonly DateTime creationTime = DateTime.Now;
- private readonly Dictionary benchmarkToTraceFile = new ();
- private readonly HashSet cliPathWithSymbolsInstalled = new ();
+ private readonly Dictionary benchmarkToTraceFile = new();
+ private readonly HashSet cliPathWithSymbolsInstalled = new();
private FileInfo perfCollectFile;
private Process perfCollectProcess;
@@ -228,7 +228,7 @@ private void EnsureSymbolsForNativeRuntime(DiagnoserActionParameters parameters)
ILogger logger = parameters.Config.GetCompositeLogger();
// We install the tool in a dedicated directory in order to always use latest version and avoid issues with broken existing configs.
string toolPath = Path.Combine(Path.GetTempPath(), "BenchmarkDotNet", "symbols");
- DotNetCliCommand cliCommand = new (
+ DotNetCliCommand cliCommand = new(
cliPath: cliPath,
arguments: $"tool install dotnet-symbol --tool-path \"{toolPath}\"",
generateResult: null,
@@ -253,7 +253,7 @@ private void EnsureSymbolsForNativeRuntime(DiagnoserActionParameters parameters)
}
private FileInfo GetTraceFile(DiagnoserActionParameters parameters, string extension)
- => new (ArtifactFileNameHelper.GetTraceFilePath(parameters, creationTime, extension)
+ => new(ArtifactFileNameHelper.GetTraceFilePath(parameters, creationTime, extension)
.Replace(" ", "_")); // perfcollect does not allow for spaces in the trace file name
}
}
diff --git a/src/BenchmarkDotNet/Disassemblers/Arm64Disassembler.cs b/src/BenchmarkDotNet/Disassemblers/Arm64Disassembler.cs
index ce5176c4ca..7c10765b8e 100644
--- a/src/BenchmarkDotNet/Disassemblers/Arm64Disassembler.cs
+++ b/src/BenchmarkDotNet/Disassemblers/Arm64Disassembler.cs
@@ -189,7 +189,7 @@ internal RuntimeSpecificData(State state)
}
}
- private static readonly Dictionary runtimeSpecificData = new ();
+ private static readonly Dictionary runtimeSpecificData = new();
protected override IEnumerable Decode(byte[] code, ulong startAddress, State state, int depth, ClrMethod currentMethod, DisassemblySyntax syntax)
{
diff --git a/src/BenchmarkDotNet/Disassemblers/Arm64InstructionFormatter.cs b/src/BenchmarkDotNet/Disassemblers/Arm64InstructionFormatter.cs
index deb557256c..5426dcfdd9 100644
--- a/src/BenchmarkDotNet/Disassemblers/Arm64InstructionFormatter.cs
+++ b/src/BenchmarkDotNet/Disassemblers/Arm64InstructionFormatter.cs
@@ -12,7 +12,7 @@ internal static class Arm64InstructionFormatter
internal static string Format(Arm64Asm asm, FormatterOptions formatterOptions,
bool printInstructionAddresses, uint pointerSize, IReadOnlyDictionary symbols)
{
- StringBuilder output = new ();
+ StringBuilder output = new();
Arm64Instruction instruction = asm.Instruction;
if (printInstructionAddresses)
diff --git a/src/BenchmarkDotNet/Disassemblers/IntelDisassembler.cs b/src/BenchmarkDotNet/Disassemblers/IntelDisassembler.cs
index 3fd541528a..eb0d5ce3f6 100644
--- a/src/BenchmarkDotNet/Disassemblers/IntelDisassembler.cs
+++ b/src/BenchmarkDotNet/Disassemblers/IntelDisassembler.cs
@@ -46,7 +46,7 @@ internal RuntimeSpecificData(State state)
}
}
- private static readonly Dictionary runtimeSpecificData = new ();
+ private static readonly Dictionary runtimeSpecificData = new();
protected override IEnumerable Decode(byte[] code, ulong startAddress, State state, int depth, ClrMethod currentMethod, DisassemblySyntax syntax)
{
diff --git a/src/BenchmarkDotNet/Disassemblers/SameArchitectureDisassembler.cs b/src/BenchmarkDotNet/Disassemblers/SameArchitectureDisassembler.cs
index 8ce026a5dd..1a4835484d 100644
--- a/src/BenchmarkDotNet/Disassemblers/SameArchitectureDisassembler.cs
+++ b/src/BenchmarkDotNet/Disassemblers/SameArchitectureDisassembler.cs
@@ -26,7 +26,7 @@ private static ClrMdV3Disassembler CreateDisassemblerForCurrentArchitecture()
};
private Settings BuildDisassemblerSettings(DiagnoserActionParameters parameters)
- => new (
+ => new(
processId: parameters.Process.Id,
typeName: $"BenchmarkDotNet.Autogenerated.Runnable_{parameters.BenchmarkId.Value}",
methodName: DisassemblerConstants.DisassemblerEntryMethodName,
diff --git a/src/BenchmarkDotNet/Engines/Engine.cs b/src/BenchmarkDotNet/Engines/Engine.cs
index 44077fcc38..1fc1b96dfd 100644
--- a/src/BenchmarkDotNet/Engines/Engine.cs
+++ b/src/BenchmarkDotNet/Engines/Engine.cs
@@ -42,7 +42,7 @@ public class Engine : IEngine
private bool EvaluateOverhead { get; }
private bool MemoryRandomization { get; }
- private readonly List jittingMeasurements = new (10);
+ private readonly List jittingMeasurements = new(10);
private readonly bool includeExtraStats;
private readonly Random random;
@@ -351,8 +351,8 @@ private sealed class Impl
// ManualResetEvent(Slim) allocates when it is waited and yields the thread,
// so we use Monitor.Wait instead which does not allocate managed memory.
// This behavior is not documented, but was observed with the VS Profiler.
- private readonly object hangLock = new ();
- private readonly ManualResetEventSlim enteredFinalizerEvent = new (false);
+ private readonly object hangLock = new();
+ private readonly ManualResetEventSlim enteredFinalizerEvent = new(false);
~Impl()
{
diff --git a/src/BenchmarkDotNet/Engines/EngineActualStage.cs b/src/BenchmarkDotNet/Engines/EngineActualStage.cs
index 482208ac68..173f4e3432 100644
--- a/src/BenchmarkDotNet/Engines/EngineActualStage.cs
+++ b/src/BenchmarkDotNet/Engines/EngineActualStage.cs
@@ -47,7 +47,7 @@ public EngineActualStageAuto(Job targetJob, IResolver resolver, IterationMode it
measurementsForStatistics = GetMeasurementList();
}
- internal override List GetMeasurementList() => new (maxIterationCount);
+ internal override List GetMeasurementList() => new(maxIterationCount);
internal override bool GetShouldRunIteration(List measurements, ref long invokeCount)
{
@@ -88,7 +88,7 @@ internal sealed class EngineActualStageSpecific(int maxIterationCount, Iteration
{
private int iterationCount = 0;
- internal override List GetMeasurementList() => new (maxIterationCount);
+ internal override List GetMeasurementList() => new(maxIterationCount);
internal override bool GetShouldRunIteration(List measurements, ref long invokeCount)
=> ++iterationCount <= maxIterationCount;
diff --git a/src/BenchmarkDotNet/Engines/EngineWarmupStage.cs b/src/BenchmarkDotNet/Engines/EngineWarmupStage.cs
index a82ca61a91..26a1f1f68b 100644
--- a/src/BenchmarkDotNet/Engines/EngineWarmupStage.cs
+++ b/src/BenchmarkDotNet/Engines/EngineWarmupStage.cs
@@ -35,7 +35,7 @@ internal sealed class EngineWarmupStageAuto(IterationMode iterationMode, int min
private readonly int minIterationCount = minIterationCount;
private readonly int maxIterationCount = maxIterationCount;
- internal override List GetMeasurementList() => new (maxIterationCount);
+ internal override List GetMeasurementList() => new(maxIterationCount);
internal override bool GetShouldRunIteration(List measurements, ref long invokeCount)
{
@@ -70,7 +70,7 @@ internal sealed class EngineWarmupStageSpecific(int maxIterationCount, Iteration
{
private int iterationCount = 0;
- internal override List GetMeasurementList() => new (maxIterationCount);
+ internal override List GetMeasurementList() => new(maxIterationCount);
internal override bool GetShouldRunIteration(List measurements, ref long invokeCount)
=> ++iterationCount <= maxIterationCount;
diff --git a/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs b/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs
index 0abb7b8e49..8291354090 100644
--- a/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs
+++ b/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs
@@ -133,7 +133,7 @@ public static string GetInformation()
return sb.ToString();
}
- internal BdnHostInfo ToPerfonar() => new ()
+ internal BdnHostInfo ToPerfonar() => new()
{
Cpu = Cpu.Value,
Os = Os.Value,
diff --git a/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs
index 53476adbc8..954a8ac7dc 100644
--- a/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs
+++ b/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs
@@ -11,17 +11,17 @@ namespace BenchmarkDotNet.Environments
{
public class CoreRuntime : Runtime
{
- public static readonly CoreRuntime Core20 = new (RuntimeMoniker.NetCoreApp20, "netcoreapp2.0", ".NET Core 2.0");
- public static readonly CoreRuntime Core21 = new (RuntimeMoniker.NetCoreApp21, "netcoreapp2.1", ".NET Core 2.1");
- public static readonly CoreRuntime Core22 = new (RuntimeMoniker.NetCoreApp22, "netcoreapp2.2", ".NET Core 2.2");
- public static readonly CoreRuntime Core30 = new (RuntimeMoniker.NetCoreApp30, "netcoreapp3.0", ".NET Core 3.0");
- public static readonly CoreRuntime Core31 = new (RuntimeMoniker.NetCoreApp31, "netcoreapp3.1", ".NET Core 3.1");
- public static readonly CoreRuntime Core50 = new (RuntimeMoniker.Net50, "net5.0", ".NET 5.0");
- public static readonly CoreRuntime Core60 = new (RuntimeMoniker.Net60, "net6.0", ".NET 6.0");
- public static readonly CoreRuntime Core70 = new (RuntimeMoniker.Net70, "net7.0", ".NET 7.0");
- public static readonly CoreRuntime Core80 = new (RuntimeMoniker.Net80, "net8.0", ".NET 8.0");
- public static readonly CoreRuntime Core90 = new (RuntimeMoniker.Net90, "net9.0", ".NET 9.0");
- public static readonly CoreRuntime Core10_0 = new (RuntimeMoniker.Net10_0, "net10.0", ".NET 10.0");
+ public static readonly CoreRuntime Core20 = new(RuntimeMoniker.NetCoreApp20, "netcoreapp2.0", ".NET Core 2.0");
+ public static readonly CoreRuntime Core21 = new(RuntimeMoniker.NetCoreApp21, "netcoreapp2.1", ".NET Core 2.1");
+ public static readonly CoreRuntime Core22 = new(RuntimeMoniker.NetCoreApp22, "netcoreapp2.2", ".NET Core 2.2");
+ public static readonly CoreRuntime Core30 = new(RuntimeMoniker.NetCoreApp30, "netcoreapp3.0", ".NET Core 3.0");
+ public static readonly CoreRuntime Core31 = new(RuntimeMoniker.NetCoreApp31, "netcoreapp3.1", ".NET Core 3.1");
+ public static readonly CoreRuntime Core50 = new(RuntimeMoniker.Net50, "net5.0", ".NET 5.0");
+ public static readonly CoreRuntime Core60 = new(RuntimeMoniker.Net60, "net6.0", ".NET 6.0");
+ public static readonly CoreRuntime Core70 = new(RuntimeMoniker.Net70, "net7.0", ".NET 7.0");
+ public static readonly CoreRuntime Core80 = new(RuntimeMoniker.Net80, "net8.0", ".NET 8.0");
+ public static readonly CoreRuntime Core90 = new(RuntimeMoniker.Net90, "net9.0", ".NET 9.0");
+ public static readonly CoreRuntime Core10_0 = new(RuntimeMoniker.Net10_0, "net10.0", ".NET 10.0");
public static CoreRuntime Latest => Core10_0; // when dotnet/runtime branches for 11.0, this will need to get updated
diff --git a/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs
index 15b5a02669..c1c37db2cd 100644
--- a/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs
+++ b/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs
@@ -5,12 +5,12 @@ namespace BenchmarkDotNet.Environments
{
public class MonoRuntime : Runtime, IEquatable
{
- public static readonly MonoRuntime Default = new ("Mono");
- public static readonly MonoRuntime Mono60 = new ("Mono with .NET 6.0", RuntimeMoniker.Mono60, "net6.0", isDotNetBuiltIn: true);
- public static readonly MonoRuntime Mono70 = new ("Mono with .NET 7.0", RuntimeMoniker.Mono70, "net7.0", isDotNetBuiltIn: true);
- public static readonly MonoRuntime Mono80 = new ("Mono with .NET 8.0", RuntimeMoniker.Mono80, "net8.0", isDotNetBuiltIn: true);
- public static readonly MonoRuntime Mono90 = new ("Mono with .NET 9.0", RuntimeMoniker.Mono90, "net9.0", isDotNetBuiltIn: true);
- public static readonly MonoRuntime Mono10_0 = new ("Mono with .NET 10.0", RuntimeMoniker.Mono10_0, "net10.0", isDotNetBuiltIn: true);
+ public static readonly MonoRuntime Default = new("Mono");
+ public static readonly MonoRuntime Mono60 = new("Mono with .NET 6.0", RuntimeMoniker.Mono60, "net6.0", isDotNetBuiltIn: true);
+ public static readonly MonoRuntime Mono70 = new("Mono with .NET 7.0", RuntimeMoniker.Mono70, "net7.0", isDotNetBuiltIn: true);
+ public static readonly MonoRuntime Mono80 = new("Mono with .NET 8.0", RuntimeMoniker.Mono80, "net8.0", isDotNetBuiltIn: true);
+ public static readonly MonoRuntime Mono90 = new("Mono with .NET 9.0", RuntimeMoniker.Mono90, "net9.0", isDotNetBuiltIn: true);
+ public static readonly MonoRuntime Mono10_0 = new("Mono with .NET 10.0", RuntimeMoniker.Mono10_0, "net10.0", isDotNetBuiltIn: true);
public string CustomPath { get; }
diff --git a/src/BenchmarkDotNet/Helpers/AwaitHelper.cs b/src/BenchmarkDotNet/Helpers/AwaitHelper.cs
index 8d16fb716a..98837a7ea6 100644
--- a/src/BenchmarkDotNet/Helpers/AwaitHelper.cs
+++ b/src/BenchmarkDotNet/Helpers/AwaitHelper.cs
@@ -22,7 +22,7 @@ private class ValueTaskWaiter
private ValueTaskWaiter()
{
- resetEvent = new ();
+ resetEvent = new();
awaiterCallback = resetEvent.Set;
}
diff --git a/src/BenchmarkDotNet/Helpers/UnitHelper.cs b/src/BenchmarkDotNet/Helpers/UnitHelper.cs
index ae76faf101..9575401776 100644
--- a/src/BenchmarkDotNet/Helpers/UnitHelper.cs
+++ b/src/BenchmarkDotNet/Helpers/UnitHelper.cs
@@ -5,7 +5,7 @@ namespace BenchmarkDotNet.Helpers;
public static class UnitHelper
{
- public static readonly UnitPresentation DefaultPresentation = new (true, 0, gap: true);
+ public static readonly UnitPresentation DefaultPresentation = new(true, 0, gap: true);
public static string ToDefaultString(this TimeInterval timeInterval, string? format = null) => timeInterval.ToString(format, null, DefaultPresentation);
}
\ No newline at end of file
diff --git a/src/BenchmarkDotNet/Helpers/XUnitHelper.cs b/src/BenchmarkDotNet/Helpers/XUnitHelper.cs
index 559113a8f4..7f7415bdfa 100644
--- a/src/BenchmarkDotNet/Helpers/XUnitHelper.cs
+++ b/src/BenchmarkDotNet/Helpers/XUnitHelper.cs
@@ -6,5 +6,5 @@ namespace BenchmarkDotNet.Helpers;
internal static class XUnitHelper
{
public static Lazy IsIntegrationTest =
- new (() => AppDomain.CurrentDomain.GetAssemblies().Any(assembly => assembly.GetName().Name == "BenchmarkDotNet.IntegrationTests"));
+ new(() => AppDomain.CurrentDomain.GetAssemblies().Any(assembly => assembly.GetName().Name == "BenchmarkDotNet.IntegrationTests"));
}
\ No newline at end of file
diff --git a/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs b/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs
index 104ec25150..0d5113db48 100644
--- a/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs
+++ b/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs
@@ -139,7 +139,7 @@ public void SetEnvironmentVariable(EnvironmentVariable variable)
internal Runtime GetRuntime() => HasValue(RuntimeCharacteristic) ? Runtime : RuntimeInformation.GetCurrentRuntime();
- internal BdnEnvironment ToPerfonar() => new ()
+ internal BdnEnvironment ToPerfonar() => new()
{
Jit = HasValue(JitCharacteristic) ? Jit : null,
Runtime = HasValue(RuntimeCharacteristic) ? Runtime?.RuntimeMoniker : null,
diff --git a/src/BenchmarkDotNet/Jobs/RunMode.cs b/src/BenchmarkDotNet/Jobs/RunMode.cs
index 66ab07edb1..3e1e56c22f 100644
--- a/src/BenchmarkDotNet/Jobs/RunMode.cs
+++ b/src/BenchmarkDotNet/Jobs/RunMode.cs
@@ -191,7 +191,7 @@ public bool MemoryRandomization
set => MemoryRandomizationCharacteristic[this] = value;
}
- internal BdnExecution ToPerfonar() => new ()
+ internal BdnExecution ToPerfonar() => new()
{
LaunchCount = HasValue(LaunchCountCharacteristic) ? LaunchCount : null,
WarmupCount = HasValue(WarmupCountCharacteristic) ? WarmupCount : null,
diff --git a/src/BenchmarkDotNet/Loggers/Broker.cs b/src/BenchmarkDotNet/Loggers/Broker.cs
index dcec4c0d56..277cd3c430 100644
--- a/src/BenchmarkDotNet/Loggers/Broker.cs
+++ b/src/BenchmarkDotNet/Loggers/Broker.cs
@@ -76,8 +76,8 @@ private void OnProcessExited(object sender, EventArgs e)
private void ProcessDataBlocking()
{
- using StreamReader reader = new (inputFromBenchmark, AnonymousPipesHost.UTF8NoBOM, detectEncodingFromByteOrderMarks: false);
- using StreamWriter writer = new (acknowledgments, AnonymousPipesHost.UTF8NoBOM, bufferSize: 1);
+ using StreamReader reader = new(inputFromBenchmark, AnonymousPipesHost.UTF8NoBOM, detectEncodingFromByteOrderMarks: false);
+ using StreamWriter writer = new(acknowledgments, AnonymousPipesHost.UTF8NoBOM, bufferSize: 1);
// Flush the data to the Stream after each write, otherwise the client will wait for input endlessly!
writer.AutoFlush = true;
diff --git a/src/BenchmarkDotNet/Models/BdnSchema.cs b/src/BenchmarkDotNet/Models/BdnSchema.cs
index 862bda09c6..3006b702de 100644
--- a/src/BenchmarkDotNet/Models/BdnSchema.cs
+++ b/src/BenchmarkDotNet/Models/BdnSchema.cs
@@ -4,7 +4,7 @@ namespace BenchmarkDotNet.Models;
internal class BdnSchema : PerfonarSchema
{
- public static readonly BdnSchema Instance = new ();
+ public static readonly BdnSchema Instance = new();
private BdnSchema() : base("bdn")
{
diff --git a/src/BenchmarkDotNet/Order/CategoryComparer.cs b/src/BenchmarkDotNet/Order/CategoryComparer.cs
index a64fb7c588..ac11695a59 100644
--- a/src/BenchmarkDotNet/Order/CategoryComparer.cs
+++ b/src/BenchmarkDotNet/Order/CategoryComparer.cs
@@ -7,7 +7,7 @@ namespace BenchmarkDotNet.Order
internal class CategoryComparer : IComparer
{
private const string Separator = "ยง";
- public static readonly CategoryComparer Instance = new ();
+ public static readonly CategoryComparer Instance = new();
public int Compare(string[] x, string[] y)
{
diff --git a/src/BenchmarkDotNet/Properties/BenchmarkDotNetInfo.cs b/src/BenchmarkDotNet/Properties/BenchmarkDotNetInfo.cs
index eac67a37eb..0941fa1cc3 100644
--- a/src/BenchmarkDotNet/Properties/BenchmarkDotNetInfo.cs
+++ b/src/BenchmarkDotNet/Properties/BenchmarkDotNetInfo.cs
@@ -9,7 +9,7 @@ public class BenchmarkDotNetInfo
{
public const string BenchmarkDotNetCaption = "BenchmarkDotNet";
- private static readonly Lazy LazyInstance = new (() =>
+ private static readonly Lazy LazyInstance = new(() =>
{
var assembly = typeof(BenchmarkDotNetInfo).GetTypeInfo().Assembly;
var assemblyVersion = assembly.GetName().Version;
@@ -19,7 +19,7 @@ public class BenchmarkDotNetInfo
public static BenchmarkDotNetInfo Instance { get; } = LazyInstance.Value;
- public EngineInfo GetBdnEngineInfo() => new ()
+ public EngineInfo GetBdnEngineInfo() => new()
{
Name = BenchmarkDotNetCaption,
Version = BrandVersion
diff --git a/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs b/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs
index 810e79ab8a..8ed930c1f4 100644
--- a/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs
+++ b/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs
@@ -622,8 +622,8 @@ private static void LogTotalTime(ILogger logger, TimeSpan time, int executedBenc
private static (BenchmarkRunInfo[], List) GetSupportedBenchmarks(BenchmarkRunInfo[] benchmarkRunInfos, IResolver resolver)
{
- List validationErrors = new ();
- List runInfos = new (benchmarkRunInfos.Length);
+ List validationErrors = new();
+ List runInfos = new(benchmarkRunInfos.Length);
if (benchmarkRunInfos.Length == 0)
{
diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs
index 81f48b4413..bcd921fdd1 100644
--- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs
+++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs
@@ -47,10 +47,10 @@ public DotNetCliCommand(string cliPath, string arguments, GenerateResult generat
}
public DotNetCliCommand WithArguments(string arguments)
- => new (CliPath, arguments, GenerateResult, Logger, BuildPartition, EnvironmentVariables, Timeout, logOutput: LogOutput);
+ => new(CliPath, arguments, GenerateResult, Logger, BuildPartition, EnvironmentVariables, Timeout, logOutput: LogOutput);
public DotNetCliCommand WithCliPath(string cliPath)
- => new (cliPath, Arguments, GenerateResult, Logger, BuildPartition, EnvironmentVariables, Timeout, logOutput: LogOutput);
+ => new(cliPath, Arguments, GenerateResult, Logger, BuildPartition, EnvironmentVariables, Timeout, logOutput: LogOutput);
[PublicAPI]
public BuildResult RestoreThenBuild()
diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs
index 5cbff89b47..10df4af9b3 100644
--- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs
+++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs
@@ -157,7 +157,7 @@ private static string GetDefaultDotNetCliPath()
internal static string GetSdkPath(string cliPath)
{
- DotNetCliCommand cliCommand = new (
+ DotNetCliCommand cliCommand = new(
cliPath: cliPath,
arguments: "--info",
generateResult: null,
diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliExecutor.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliExecutor.cs
index f8bea8236e..d0595fe166 100644
--- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliExecutor.cs
+++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliExecutor.cs
@@ -75,11 +75,11 @@ private ExecuteResult Execute(BenchmarkCase benchmarkCase,
startInfo.SetEnvironmentVariables(benchmarkCase, resolver);
- using (Process process = new () { StartInfo = startInfo })
- using (ConsoleExitHandler consoleExitHandler = new (process, logger))
- using (AsyncProcessOutputReader processOutputReader = new (process, logOutput: true, logger, readStandardError: false))
+ using (Process process = new() { StartInfo = startInfo })
+ using (ConsoleExitHandler consoleExitHandler = new(process, logger))
+ using (AsyncProcessOutputReader processOutputReader = new(process, logOutput: true, logger, readStandardError: false))
{
- Broker broker = new (logger, process, diagnoser, benchmarkCase, benchmarkId, inputFromBenchmark, acknowledgments);
+ Broker broker = new(logger, process, diagnoser, benchmarkCase, benchmarkId, inputFromBenchmark, acknowledgments);
logger.WriteLineInfo($"// Execute: {process.StartInfo.FileName} {process.StartInfo.Arguments} in {process.StartInfo.WorkingDirectory}");
diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs
index 028e4f2bd3..807e394682 100644
--- a/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs
+++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs
@@ -9,17 +9,17 @@ namespace BenchmarkDotNet.Toolchains.DotNetCli
[PublicAPI]
public class NetCoreAppSettings
{
- [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp20 = new ("netcoreapp2.0", null, ".NET Core 2.0");
- [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp21 = new ("netcoreapp2.1", null, ".NET Core 2.1");
- [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp22 = new ("netcoreapp2.2", null, ".NET Core 2.2");
- [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp30 = new ("netcoreapp3.0", null, ".NET Core 3.0");
- [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp31 = new ("netcoreapp3.1", null, ".NET Core 3.1");
- [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp50 = new ("net5.0", null, ".NET 5.0");
- [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp60 = new ("net6.0", null, ".NET 6.0");
- [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp70 = new ("net7.0", null, ".NET 7.0");
- [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp80 = new ("net8.0", null, ".NET 8.0");
- [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp90 = new ("net9.0", null, ".NET 9.0");
- [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp10_0 = new ("net10.0", null, ".NET 10.0");
+ [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp20 = new("netcoreapp2.0", null, ".NET Core 2.0");
+ [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp21 = new("netcoreapp2.1", null, ".NET Core 2.1");
+ [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp22 = new("netcoreapp2.2", null, ".NET Core 2.2");
+ [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp30 = new("netcoreapp3.0", null, ".NET Core 3.0");
+ [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp31 = new("netcoreapp3.1", null, ".NET Core 3.1");
+ [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp50 = new("net5.0", null, ".NET 5.0");
+ [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp60 = new("net6.0", null, ".NET 6.0");
+ [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp70 = new("net7.0", null, ".NET 7.0");
+ [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp80 = new("net8.0", null, ".NET 8.0");
+ [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp90 = new("net9.0", null, ".NET 9.0");
+ [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp10_0 = new("net10.0", null, ".NET 10.0");
///
///
diff --git a/src/BenchmarkDotNet/Toolchains/Executor.cs b/src/BenchmarkDotNet/Toolchains/Executor.cs
index 8fbce03516..adc05e12e6 100644
--- a/src/BenchmarkDotNet/Toolchains/Executor.cs
+++ b/src/BenchmarkDotNet/Toolchains/Executor.cs
@@ -41,16 +41,16 @@ private static ExecuteResult Execute(BenchmarkCase benchmarkCase, BenchmarkId be
{
try
{
- using AnonymousPipeServerStream inputFromBenchmark = new (PipeDirection.In, HandleInheritability.Inheritable);
- using AnonymousPipeServerStream acknowledgments = new (PipeDirection.Out, HandleInheritability.Inheritable);
+ using AnonymousPipeServerStream inputFromBenchmark = new(PipeDirection.In, HandleInheritability.Inheritable);
+ using AnonymousPipeServerStream acknowledgments = new(PipeDirection.Out, HandleInheritability.Inheritable);
string args = benchmarkId.ToArguments(inputFromBenchmark.GetClientHandleAsString(), acknowledgments.GetClientHandleAsString());
- using (Process process = new () { StartInfo = CreateStartInfo(benchmarkCase, artifactsPaths, args, resolver) })
- using (ConsoleExitHandler consoleExitHandler = new (process, logger))
- using (AsyncProcessOutputReader processOutputReader = new (process, logOutput: true, logger, readStandardError: false))
+ using (Process process = new() { StartInfo = CreateStartInfo(benchmarkCase, artifactsPaths, args, resolver) })
+ using (ConsoleExitHandler consoleExitHandler = new(process, logger))
+ using (AsyncProcessOutputReader processOutputReader = new(process, logOutput: true, logger, readStandardError: false))
{
- Broker broker = new (logger, process, diagnoser, benchmarkCase, benchmarkId, inputFromBenchmark, acknowledgments);
+ Broker broker = new(logger, process, diagnoser, benchmarkCase, benchmarkId, inputFromBenchmark, acknowledgments);
diagnoser?.Handle(HostSignal.BeforeProcessStart, new DiagnoserActionParameters(process, benchmarkCase, benchmarkId));
diff --git a/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmExecutor.cs b/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmExecutor.cs
index 7e857ff364..e6756ebcbe 100644
--- a/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmExecutor.cs
+++ b/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmExecutor.cs
@@ -38,8 +38,8 @@ private static ExecuteResult Execute(BenchmarkCase benchmarkCase, BenchmarkId be
try
{
using (Process process = CreateProcess(benchmarkCase, artifactsPaths, benchmarkId.ToArguments(), resolver))
- using (ConsoleExitHandler consoleExitHandler = new (process, logger))
- using (AsyncProcessOutputReader processOutputReader = new (process, logOutput: true, logger, readStandardError: false))
+ using (ConsoleExitHandler consoleExitHandler = new(process, logger))
+ using (AsyncProcessOutputReader processOutputReader = new(process, logOutput: true, logger, readStandardError: false))
{
diagnoser?.Handle(HostSignal.BeforeProcessStart, new DiagnoserActionParameters(process, benchmarkCase, benchmarkId));
diff --git a/src/BenchmarkDotNet/Validators/ParamsValidator.cs b/src/BenchmarkDotNet/Validators/ParamsValidator.cs
index 5a503148d5..37dc645af5 100644
--- a/src/BenchmarkDotNet/Validators/ParamsValidator.cs
+++ b/src/BenchmarkDotNet/Validators/ParamsValidator.cs
@@ -9,7 +9,7 @@ namespace BenchmarkDotNet.Validators
{
public class ParamsValidator : IValidator
{
- public static readonly ParamsValidator FailOnError = new ();
+ public static readonly ParamsValidator FailOnError = new();
public bool TreatsWarningsAsErrors => true;
diff --git a/tests/BenchmarkDotNet.IntegrationTests/AllSetupAndCleanupTest.cs b/tests/BenchmarkDotNet.IntegrationTests/AllSetupAndCleanupTest.cs
index 459c23c2c2..36ea5688ad 100644
--- a/tests/BenchmarkDotNet.IntegrationTests/AllSetupAndCleanupTest.cs
+++ b/tests/BenchmarkDotNet.IntegrationTests/AllSetupAndCleanupTest.cs
@@ -196,7 +196,7 @@ public async ValueTask GlobalCleanup()
public class AllSetupAndCleanupAttributeBenchmarksValueTaskSource
{
- private readonly ValueTaskSource valueTaskSource = new ();
+ private readonly ValueTaskSource valueTaskSource = new();
private int setupCounter;
private int cleanupCounter;
@@ -228,7 +228,7 @@ public ValueTask GlobalCleanup()
public class AllSetupAndCleanupAttributeBenchmarksGenericValueTaskSource
{
- private readonly ValueTaskSource valueTaskSource = new ();
+ private readonly ValueTaskSource valueTaskSource = new();
private int setupCounter;
private int cleanupCounter;
diff --git a/tests/BenchmarkDotNet.IntegrationTests/AsyncBenchmarksTests.cs b/tests/BenchmarkDotNet.IntegrationTests/AsyncBenchmarksTests.cs
index d795b1a102..a2158362ef 100644
--- a/tests/BenchmarkDotNet.IntegrationTests/AsyncBenchmarksTests.cs
+++ b/tests/BenchmarkDotNet.IntegrationTests/AsyncBenchmarksTests.cs
@@ -63,7 +63,7 @@ public void TaskReturningMethodsAreAwaited()
public class TaskDelayMethods
{
- private readonly ValueTaskSource valueTaskSource = new ();
+ private readonly ValueTaskSource valueTaskSource = new();
private const int MillisecondsDelay = 100;
@@ -112,8 +112,8 @@ public ValueTask ReturningGenericValueTaskBackByIValueTaskSource()
public class TaskImmediateMethods
{
- private readonly ValueTaskSource valueTaskSource = new ();
- private readonly ValueTaskSourceCallbackOnly valueTaskSourceCallbackOnly = new ();
+ private readonly ValueTaskSource valueTaskSource = new();
+ private readonly ValueTaskSourceCallbackOnly valueTaskSourceCallbackOnly = new();
[Benchmark]
public Task ReturningTask() => Task.CompletedTask;
diff --git a/tests/BenchmarkDotNet.IntegrationTests/CustomEngineTests.cs b/tests/BenchmarkDotNet.IntegrationTests/CustomEngineTests.cs
index 43a7bac9ee..f6d0a10f83 100644
--- a/tests/BenchmarkDotNet.IntegrationTests/CustomEngineTests.cs
+++ b/tests/BenchmarkDotNet.IntegrationTests/CustomEngineTests.cs
@@ -74,8 +74,8 @@ public RunResults Run()
return new RunResults(
new List
{
- new (1, IterationMode.Overhead, IterationStage.Actual, 1, 1, 1),
- new (1, IterationMode.Workload, IterationStage.Actual, 1, 1, 1)
+ new(1, IterationMode.Overhead, IterationStage.Actual, 1, 1, 1),
+ new(1, IterationMode.Workload, IterationStage.Actual, 1, 1, 1)
},
OutlierMode.DontRemove,
default,
diff --git a/tests/BenchmarkDotNet.IntegrationTests/InProcessEmitTest.cs b/tests/BenchmarkDotNet.IntegrationTests/InProcessEmitTest.cs
index 538384b999..4b9ea2005b 100644
--- a/tests/BenchmarkDotNet.IntegrationTests/InProcessEmitTest.cs
+++ b/tests/BenchmarkDotNet.IntegrationTests/InProcessEmitTest.cs
@@ -331,7 +331,7 @@ public void InvokeOnceVoid()
public class GlobalSetupCleanupValueTaskSource
{
- private readonly static ValueTaskSource valueTaskSource = new ();
+ private readonly static ValueTaskSource valueTaskSource = new();
[GlobalSetup]
public static ValueTask GlobalSetup()
diff --git a/tests/BenchmarkDotNet.IntegrationTests/MemoryDiagnoserTests.cs b/tests/BenchmarkDotNet.IntegrationTests/MemoryDiagnoserTests.cs
index 9d92b38755..4cd2a39c23 100755
--- a/tests/BenchmarkDotNet.IntegrationTests/MemoryDiagnoserTests.cs
+++ b/tests/BenchmarkDotNet.IntegrationTests/MemoryDiagnoserTests.cs
@@ -257,8 +257,8 @@ public class MultiThreadedAllocation
// to avoid measuring the cost of thread start and join, which varies across different runtimes.
private Thread[] threads;
private volatile bool keepRunning = true;
- private readonly Barrier barrier = new (ThreadsCount + 1);
- private readonly CountdownEvent countdownEvent = new (ThreadsCount);
+ private readonly Barrier barrier = new(ThreadsCount + 1);
+ private readonly CountdownEvent countdownEvent = new(ThreadsCount);
[GlobalSetup]
public void Setup()
diff --git a/tests/BenchmarkDotNet.Tests/Builders/HostEnvironmentInfoBuilder.cs b/tests/BenchmarkDotNet.Tests/Builders/HostEnvironmentInfoBuilder.cs
index 85e31352ec..29d690892b 100644
--- a/tests/BenchmarkDotNet.Tests/Builders/HostEnvironmentInfoBuilder.cs
+++ b/tests/BenchmarkDotNet.Tests/Builders/HostEnvironmentInfoBuilder.cs
@@ -23,10 +23,10 @@ public class HostEnvironmentInfoBuilder
private bool isServerGC = false;
private string jitInfo = "RyuJIT-v4.6.x.mock";
private string jitModules = "clrjit-v4.6.x.mock";
- private OsInfo os = new () { Display = "Microsoft Windows NT 10.0.x.mock" };
+ private OsInfo os = new() { Display = "Microsoft Windows NT 10.0.x.mock" };
private string runtimeVersion = "Clr 4.0.x.mock";
- private readonly CpuInfo cpu = new ()
+ private readonly CpuInfo cpu = new()
{
ProcessorName = "MockIntel(R) Core(TM) i7-6700HQ CPU 2.60GHz",
PhysicalProcessorCount = 1,
diff --git a/tests/BenchmarkDotNet.Tests/KnownIssue.cs b/tests/BenchmarkDotNet.Tests/KnownIssue.cs
index fe6cb83ee5..1831ad3b08 100644
--- a/tests/BenchmarkDotNet.Tests/KnownIssue.cs
+++ b/tests/BenchmarkDotNet.Tests/KnownIssue.cs
@@ -2,7 +2,7 @@ namespace BenchmarkDotNet.Tests
{
public class KnownIssue
{
- public static KnownIssue Issue2299 => new (2299, "Non-supported Mono on Linux", false);
+ public static KnownIssue Issue2299 => new(2299, "Non-supported Mono on Linux", false);
public int Number { get; }
public string Description { get; }
diff --git a/tests/BenchmarkDotNet.Tests/Mocks/Toolchain/MockToolchain.cs b/tests/BenchmarkDotNet.Tests/Mocks/Toolchain/MockToolchain.cs
index c25929854e..365a55cb88 100644
--- a/tests/BenchmarkDotNet.Tests/Mocks/Toolchain/MockToolchain.cs
+++ b/tests/BenchmarkDotNet.Tests/Mocks/Toolchain/MockToolchain.cs
@@ -43,7 +43,7 @@ private class MockExecutor : IExecutor
public MockExecutor(Func> measurer) => this.measurer = measurer;
- public ExecuteResult Execute(ExecuteParameters executeParameters) => new (measurer(executeParameters.BenchmarkCase));
+ public ExecuteResult Execute(ExecuteParameters executeParameters) => new(measurer(executeParameters.BenchmarkCase));
}
}
}
\ No newline at end of file
diff --git a/tests/BenchmarkDotNet.Tests/Order/DefaultOrdererTests.cs b/tests/BenchmarkDotNet.Tests/Order/DefaultOrdererTests.cs
index d9d2e7490e..38b9167e99 100644
--- a/tests/BenchmarkDotNet.Tests/Order/DefaultOrdererTests.cs
+++ b/tests/BenchmarkDotNet.Tests/Order/DefaultOrdererTests.cs
@@ -19,10 +19,10 @@ namespace BenchmarkDotNet.Tests.Order
{
public class DefaultOrdererTests
{
- private static Summary CreateMockSummary() => new ("", ImmutableArray.Empty, HostEnvironmentInfo.GetCurrent(),
+ private static Summary CreateMockSummary() => new("", ImmutableArray.Empty, HostEnvironmentInfo.GetCurrent(),
"", "", TimeSpan.Zero, CultureInfo.InvariantCulture, ImmutableArray.Empty, ImmutableArray.Empty);
- private static BenchmarkCase CreateBenchmarkCase(string category, int parameter, params BenchmarkLogicalGroupRule[] rules) => new (
+ private static BenchmarkCase CreateBenchmarkCase(string category, int parameter, params BenchmarkLogicalGroupRule[] rules) => new(
new Descriptor(MockFactory.MockType, MockFactory.MockMethodInfo, categories: new[] { category }),
new Job(),
new ParameterInstances(new[]
diff --git a/tests/BenchmarkDotNet.Tests/Perfonar/Infra/PerfonarMock.cs b/tests/BenchmarkDotNet.Tests/Perfonar/Infra/PerfonarMock.cs
index 3da08dac61..f63caeafa4 100644
--- a/tests/BenchmarkDotNet.Tests/Perfonar/Infra/PerfonarMock.cs
+++ b/tests/BenchmarkDotNet.Tests/Perfonar/Infra/PerfonarMock.cs
@@ -5,7 +5,7 @@ namespace BenchmarkDotNet.Tests.Perfonar.Infra;
public static class PerfonarMock
{
- public static readonly EngineInfo Engine = new ()
+ public static readonly EngineInfo Engine = new()
{
Name = BenchmarkDotNetInfo.BenchmarkDotNetCaption,
Version = "0.1729.0-mock"
diff --git a/tests/BenchmarkDotNet.Tests/Perfonar/PerfonarTests.cs b/tests/BenchmarkDotNet.Tests/Perfonar/PerfonarTests.cs
index c6d2f586cd..81869534a1 100644
--- a/tests/BenchmarkDotNet.Tests/Perfonar/PerfonarTests.cs
+++ b/tests/BenchmarkDotNet.Tests/Perfonar/PerfonarTests.cs
@@ -137,7 +137,7 @@ public Task PerfonarTableTest(string key)
Host = new HostEnvironmentInfoBuilder().Build().ToPerfonar()
};
- private static PerfonarTableConfig GetDefaultTableConfig() => new ()
+ private static PerfonarTableConfig GetDefaultTableConfig() => new()
{
ColumnDefinitions =
[
diff --git a/tests/BenchmarkDotNet.Tests/Validators/ExecutionValidatorTests.cs b/tests/BenchmarkDotNet.Tests/Validators/ExecutionValidatorTests.cs
index fece3b3939..70195fd959 100644
--- a/tests/BenchmarkDotNet.Tests/Validators/ExecutionValidatorTests.cs
+++ b/tests/BenchmarkDotNet.Tests/Validators/ExecutionValidatorTests.cs
@@ -591,7 +591,7 @@ public void AsyncValueTaskBackedByIValueTaskSourceIsAwaitedProperly()
public class AsyncValueTaskSource
{
- private readonly ValueTaskSource valueTaskSource = new ();
+ private readonly ValueTaskSource valueTaskSource = new();
public static bool WasCalled;
@@ -622,7 +622,7 @@ public void AsyncGenericValueTaskBackedByIValueTaskSourceIsAwaitedProperly()
public class AsyncGenericValueTaskSource
{
- private readonly ValueTaskSource valueTaskSource = new ();
+ private readonly ValueTaskSource valueTaskSource = new();
public static bool WasCalled;
From 6825381ddba624e9aacc4f0508f327aaf163dbed Mon Sep 17 00:00:00 2001
From: filzrev <103790468+filzrev@users.noreply.github.com>
Date: Sat, 28 Jun 2025 12:57:08 +0900
Subject: [PATCH 3/3] fix: SA1141 value tuple error that raised by stylecop
---
.../InProcess/Emit/Implementation/Emitters/RunnableEmitter.cs | 2 +-
tests/BenchmarkDotNet.Tests/ParamsSourceTests.cs | 2 +-
tests/BenchmarkDotNet.Tests/ReflectionTests.cs | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/RunnableEmitter.cs b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/RunnableEmitter.cs
index 0e9d386a24..4796c84a77 100644
--- a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/RunnableEmitter.cs
+++ b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/RunnableEmitter.cs
@@ -1046,7 +1046,7 @@ private MethodBuilder EmitRunMethod()
{
var prepareForRunMethodTemplate = typeof(RunnableReuse).GetMethod(nameof(RunnableReuse.PrepareForRun))
?? throw new MissingMemberException(nameof(RunnableReuse.PrepareForRun));
- var resultTuple = new ValueTuple();
+ (Job, EngineParameters, IEngineFactory) resultTuple = new();
/*
.method public hidebysig static
diff --git a/tests/BenchmarkDotNet.Tests/ParamsSourceTests.cs b/tests/BenchmarkDotNet.Tests/ParamsSourceTests.cs
index 7ee8695475..c32b48d721 100644
--- a/tests/BenchmarkDotNet.Tests/ParamsSourceTests.cs
+++ b/tests/BenchmarkDotNet.Tests/ParamsSourceTests.cs
@@ -21,7 +21,7 @@ public static IEnumerable