From 95e4a9d458ecef6ea394f59700fba4c099a224d8 Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:47:09 +0900 Subject: [PATCH 1/3] chore: enable nullable annotation --- src/BenchmarkDotNet/BenchmarkDotNet.csproj | 1 + .../Characteristics/Characteristic.cs | 2 +- .../Characteristics/Characteristic`1.cs | 2 +- .../ConsoleArguments/ConfigParser.cs | 27 ++---- .../Cpu/Windows/PowershellWmiCpuDetector.cs | 4 +- .../Diagnosers/PerfCollectProfiler.cs | 7 +- .../Extensions/StringAndTextExtensions.cs | 11 ++- src/BenchmarkDotNet/Helpers/ProcessHelper.cs | 12 +-- src/BenchmarkDotNet/Jobs/EnvironmentMode.cs | 7 +- .../Parameters/ParameterInstance.cs | 2 +- .../Parameters/ParameterInstances.cs | 4 + src/BenchmarkDotNet/Running/BenchmarkCase.cs | 2 +- src/BenchmarkDotNet/Running/BuildPartition.cs | 10 +++ .../Toolchains/ArtifactsPaths.cs | 17 ++-- .../Toolchains/CoreRun/CoreRunGenerator.cs | 8 +- .../Toolchains/CoreRun/CoreRunPublisher.cs | 2 +- .../Toolchains/CoreRun/CoreRunToolchain.cs | 17 ++-- .../CsProj/CsProjClassicNetToolchain.cs | 19 ++++- .../Toolchains/CsProj/CsProjGenerator.cs | 14 +-- .../CustomDotNetCliToolchainBuilder.cs | 14 +-- .../Toolchains/DotNetCli/DotNetCliBuilder.cs | 4 +- .../Toolchains/DotNetCli/DotNetCliCommand.cs | 22 ++--- .../DotNetCli/DotNetCliCommandExecutor.cs | 10 ++- .../DotNetCli/DotNetCliGenerator.cs | 11 ++- .../DotNetCli/DotNetCliPublisher.cs | 32 +++++-- .../DotNetCli/NetCoreAppSettings.cs | 85 +++++++++++++------ .../Runnable/RunnableReflectionHelpers.cs | 19 ++--- .../InProcess/Emit/InProcessEmitGenerator.cs | 16 ++-- .../Toolchains/Mono/MonoToolchain.cs | 20 +++-- .../MonoAotLLVM/MonoAotLLVMGenerator.cs | 6 +- .../Toolchains/MonoWasm/WasmGenerator.cs | 6 +- .../Toolchains/NativeAot/Generator.cs | 38 ++++++--- .../NativeAot/NativeAotToolchain.cs | 2 + .../NativeAot/NativeAotToolchainBuilder.cs | 20 +++-- .../Toolchains/R2R/R2RGenerator.cs | 4 +- .../Toolchains/R2R/R2RToolchain.cs | 10 ++- .../Toolchains/Results/BuildResult.cs | 3 +- .../Toolchains/ToolchainExtensions.cs | 10 +-- 38 files changed, 315 insertions(+), 185 deletions(-) diff --git a/src/BenchmarkDotNet/BenchmarkDotNet.csproj b/src/BenchmarkDotNet/BenchmarkDotNet.csproj index 51f6032aa6..c4d8b56639 100644 --- a/src/BenchmarkDotNet/BenchmarkDotNet.csproj +++ b/src/BenchmarkDotNet/BenchmarkDotNet.csproj @@ -10,6 +10,7 @@ BenchmarkDotNet True + enable diff --git a/src/BenchmarkDotNet/Characteristics/Characteristic.cs b/src/BenchmarkDotNet/Characteristics/Characteristic.cs index 30c90a502f..624d3adffa 100644 --- a/src/BenchmarkDotNet/Characteristics/Characteristic.cs +++ b/src/BenchmarkDotNet/Characteristics/Characteristic.cs @@ -96,7 +96,7 @@ public object? this[CharacteristicObject obj] public bool HasChildCharacteristics => IsCharacteristicObjectSubclass(CharacteristicType); - internal virtual object? ResolveValueCore(CharacteristicObject obj, object currentValue) => + internal virtual object? ResolveValueCore(CharacteristicObject obj, object? currentValue) => ReferenceEquals(currentValue, EmptyValue) ? FallbackValue : currentValue; public override string ToString() => Id; diff --git a/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs b/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs index d28bf643c8..0b74692d45 100644 --- a/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs +++ b/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs @@ -30,7 +30,7 @@ internal Characteristic( set { obj.SetValue(this, value); } } - internal override object? ResolveValueCore(CharacteristicObject obj, object currentValue) + internal override object? ResolveValueCore(CharacteristicObject obj, object? currentValue) { if (Resolver == null) return (T?)base.ResolveValueCore(obj, currentValue); diff --git a/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs b/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs index 8eadf754e2..2c5a095b96 100644 --- a/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs +++ b/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs @@ -553,8 +553,7 @@ private static Job CreateJobForGivenRuntime(Job baseJob, string runtimeId, Comma runtimeId, runtimeFrameworkVersion: "", name: runtimeId, - options.CliPath?.FullName ?? "", - options.RestorePath?.FullName ?? ""))); + options: options))); } case RuntimeMoniker.Mono: @@ -677,8 +676,7 @@ private static Job MakeMonoJob(Job baseJob, CommandLineOptions options, MonoRunt targetFrameworkMoniker: runtime.MsBuildMoniker, runtimeFrameworkVersion: "", name: runtime.Name, - customDotNetCliPath: options.CliPath?.FullName ?? "", - packagesPath: options.RestorePath?.FullName ?? ""))); + options: options))); } private static Job MakeMonoAOTLLVMJob(Job baseJob, CommandLineOptions options, string msBuildMoniker, RuntimeMoniker moniker) @@ -694,11 +692,7 @@ private static Job MakeMonoAOTLLVMJob(Job baseJob, CommandLineOptions options, s targetFrameworkMoniker: monoAotLLVMRuntime.MsBuildMoniker, runtimeFrameworkVersion: "", name: monoAotLLVMRuntime.Name, - customDotNetCliPath: options.CliPath?.FullName ?? "", - packagesPath: options.RestorePath?.FullName ?? "", - customRuntimePack: options.CustomRuntimePack ?? "", - aotCompilerPath: options.AOTCompilerPath?.ToString() ?? "", - aotCompilerMode: options.AOTCompilerMode)); + options: options)); return baseJob.WithRuntime(monoAotLLVMRuntime).WithToolchain(toolChain).WithId(monoAotLLVMRuntime.Name); } @@ -708,12 +702,9 @@ private static Job CreateR2RJob(Job baseJob, CommandLineOptions options, Runtime var toolChain = R2RToolchain.From( new NetCoreAppSettings( targetFrameworkMoniker: runtime.MsBuildMoniker, - runtimeFrameworkVersion: null, + runtimeFrameworkVersion: "", name: runtime.Name, - customDotNetCliPath: options.CliPath?.FullName, - packagesPath: options.RestorePath?.FullName, - customRuntimePack: options.CustomRuntimePack, - aotCompilerPath: options.AOTCompilerPath != null ? options.AOTCompilerPath.ToString() : null)); + options: options)); return baseJob.WithRuntime(runtime).WithToolchain(toolChain).WithId(runtime.Name); } @@ -735,10 +726,7 @@ private static Job MakeWasmJob(Job baseJob, CommandLineOptions options, string m targetFrameworkMoniker: wasmRuntime.MsBuildMoniker, runtimeFrameworkVersion: "", name: wasmRuntime.Name, - customDotNetCliPath: options.CliPath?.FullName ?? "", - packagesPath: options.RestorePath?.FullName ?? "", - customRuntimePack: options.CustomRuntimePack ?? "", - aotCompilerMode: options.AOTCompilerMode)); + options: options)); return baseJob.WithRuntime(wasmRuntime).WithToolchain(toolChain).WithId(wasmRuntime.Name); } @@ -785,10 +773,9 @@ private static Job CreateCoreJobWithCli(Job baseJob, CommandLineOptions options) .WithToolchain(CsProjCoreToolchain.From( new NetCoreAppSettings( targetFrameworkMoniker: RuntimeInformation.GetCurrentRuntime().MsBuildMoniker, - customDotNetCliPath: options.CliPath?.FullName ?? "", runtimeFrameworkVersion: "", name: RuntimeInformation.GetCurrentRuntime().Name, - packagesPath: options.RestorePath?.FullName ?? ""))); + options: options))); /// /// we have a limited amount of space when printing the output to the console, so we try to keep things small and simple diff --git a/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuDetector.cs b/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuDetector.cs index 800c876fb9..5e256d42a1 100644 --- a/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuDetector.cs +++ b/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuDetector.cs @@ -8,6 +8,8 @@ using BenchmarkDotNet.Helpers; using Perfolizer.Models; +#nullable enable + namespace BenchmarkDotNet.Detectors.Cpu.Windows; /// @@ -32,7 +34,7 @@ internal class PowershellWmiCpuDetector : ICpuDetector $"{WmicCpuInfoKeyNames.NumberOfLogicalProcessors}, " + $"{WmicCpuInfoKeyNames.MaxClockSpeed}"; - string output = ProcessHelper.RunAndReadOutput(PowerShellLocator.LocateOnWindows() ?? "PowerShell", + string? output = ProcessHelper.RunAndReadOutput(PowerShellLocator.LocateOnWindows() ?? "PowerShell", "Get-CimInstance Win32_Processor -Property " + argList); if (output.IsBlank()) diff --git a/src/BenchmarkDotNet/Diagnosers/PerfCollectProfiler.cs b/src/BenchmarkDotNet/Diagnosers/PerfCollectProfiler.cs index 4987af44c0..3f7bb89ca1 100644 --- a/src/BenchmarkDotNet/Diagnosers/PerfCollectProfiler.cs +++ b/src/BenchmarkDotNet/Diagnosers/PerfCollectProfiler.cs @@ -10,7 +10,6 @@ using BenchmarkDotNet.Exporters; using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Helpers; -using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Loggers; using BenchmarkDotNet.Portability; using BenchmarkDotNet.Reports; @@ -20,9 +19,9 @@ using BenchmarkDotNet.Toolchains.CsProj; using BenchmarkDotNet.Toolchains.DotNetCli; using BenchmarkDotNet.Toolchains.NativeAot; +using BenchmarkDotNet.Toolchains.Results; using BenchmarkDotNet.Validators; using JetBrains.Annotations; -using RuntimeInformation = BenchmarkDotNet.Portability.RuntimeInformation; namespace BenchmarkDotNet.Diagnosers { @@ -233,9 +232,9 @@ private void EnsureSymbolsForNativeRuntime(DiagnoserActionParameters parameters) filePath: string.Empty, tfm: string.Empty, arguments: $"tool install dotnet-symbol --tool-path \"{toolPath}\"", - generateResult: null, + generateResult: GenerateResult.Success(ArtifactsPaths.Empty, []), logger: logger, - buildPartition: null, + buildPartition: BuildPartition.Empty, environmentVariables: [], timeout: TimeSpan.FromMinutes(3), logOutput: true); // the following commands might take a while and fail, let's log them diff --git a/src/BenchmarkDotNet/Extensions/StringAndTextExtensions.cs b/src/BenchmarkDotNet/Extensions/StringAndTextExtensions.cs index a51812a151..3d68f3d4c2 100644 --- a/src/BenchmarkDotNet/Extensions/StringAndTextExtensions.cs +++ b/src/BenchmarkDotNet/Extensions/StringAndTextExtensions.cs @@ -146,10 +146,19 @@ internal static StringBuilder AppendArgument(this StringBuilder stringBuilder, s /// The string builder that will hold the arguments /// The argument to append to this string builder /// The string builder with the arguments added - internal static StringBuilder AppendArgument(this StringBuilder stringBuilder, object argument) + internal static StringBuilder AppendArgument(this StringBuilder stringBuilder, object? argument) => argument == null ? stringBuilder : AppendArgument(stringBuilder, argument.ToString()!); public static bool IsBlank([NotNullWhen(false)] this string? value) => string.IsNullOrWhiteSpace(value); public static bool IsNotBlank([NotNullWhen(true)] this string? value) => !value.IsBlank(); + + /// + /// Helper method to ensure not null value. + /// It's expected to be used for public API parameters handling. + /// + public static string EnsureNotNull(this string? value) + { + return value ?? ""; + } } } \ No newline at end of file diff --git a/src/BenchmarkDotNet/Helpers/ProcessHelper.cs b/src/BenchmarkDotNet/Helpers/ProcessHelper.cs index a76702bbe5..03ebf61f39 100644 --- a/src/BenchmarkDotNet/Helpers/ProcessHelper.cs +++ b/src/BenchmarkDotNet/Helpers/ProcessHelper.cs @@ -25,9 +25,10 @@ internal static class ProcessHelper CreateNoWindow = true, RedirectStandardOutput = true, }; - if (environmentVariables != null) - foreach (var variable in environmentVariables) - processStartInfo.Environment[variable.Key] = variable.Value; + + foreach (var variable in environmentVariables ?? []) + processStartInfo.Environment[variable.Key] = variable.Value; + using (var process = new Process { StartInfo = processStartInfo }) using (new ConsoleExitHandler(process, logger ?? NullLogger.Instance)) { @@ -59,9 +60,8 @@ internal static (int exitCode, ImmutableArray output) RunAndReadOutputLi RedirectStandardError = true }; - if (environmentVariables != null) - foreach (var environmentVariable in environmentVariables) - processStartInfo.Environment[environmentVariable.Key] = environmentVariable.Value; + foreach (var environmentVariable in environmentVariables ?? []) + processStartInfo.Environment[environmentVariable.Key] = environmentVariable.Value; using (var process = new Process { StartInfo = processStartInfo }) using (var outputReader = new AsyncProcessOutputReader(process)) diff --git a/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs b/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs index 7cefe5d9fb..cf970d6420 100644 --- a/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs +++ b/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs @@ -91,9 +91,9 @@ public IntPtr Affinity /// public GcMode Gc => GcCharacteristic[this]!; - public IReadOnlyList? EnvironmentVariables + public IReadOnlyList EnvironmentVariables { - get => EnvironmentVariablesCharacteristic[this]; + get => EnvironmentVariablesCharacteristic[this] ?? []; set => EnvironmentVariablesCharacteristic[this] = value; } @@ -135,8 +135,7 @@ public bool LargeAddressAware public void SetEnvironmentVariable(EnvironmentVariable variable) { var newVariables = new List(); - if (EnvironmentVariables != null) - newVariables.AddRange(EnvironmentVariables); + newVariables.AddRange(EnvironmentVariables); newVariables.RemoveAll(v => v.Key.Equals(variable.Key, StringComparison.Ordinal)); newVariables.Add(variable); EnvironmentVariables = newVariables; diff --git a/src/BenchmarkDotNet/Parameters/ParameterInstance.cs b/src/BenchmarkDotNet/Parameters/ParameterInstance.cs index c0e4d52100..132acd0043 100644 --- a/src/BenchmarkDotNet/Parameters/ParameterInstance.cs +++ b/src/BenchmarkDotNet/Parameters/ParameterInstance.cs @@ -19,7 +19,7 @@ public class ParameterInstance : IDisposable private readonly object? value; private readonly int maxParameterColumnWidthFromConfig; - public ParameterInstance(ParameterDefinition definition, object? value, SummaryStyle summaryStyle) + public ParameterInstance(ParameterDefinition definition, object? value, SummaryStyle? summaryStyle) { Definition = definition; this.value = value; diff --git a/src/BenchmarkDotNet/Parameters/ParameterInstances.cs b/src/BenchmarkDotNet/Parameters/ParameterInstances.cs index c3cfac5391..8251935281 100644 --- a/src/BenchmarkDotNet/Parameters/ParameterInstances.cs +++ b/src/BenchmarkDotNet/Parameters/ParameterInstances.cs @@ -3,10 +3,14 @@ using System.Linq; using BenchmarkDotNet.Extensions; +#nullable enable + namespace BenchmarkDotNet.Parameters { public class ParameterInstances : IEquatable, IDisposable { + public static readonly ParameterInstances Empty = new([]); + public IReadOnlyList Items { get; } public int Count => Items.Count; public ParameterInstance this[int index] => Items[index]; diff --git a/src/BenchmarkDotNet/Running/BenchmarkCase.cs b/src/BenchmarkDotNet/Running/BenchmarkCase.cs index c166ad9721..999a622227 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkCase.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkCase.cs @@ -26,7 +26,7 @@ internal BenchmarkCase(Descriptor descriptor, Job job, ParameterInstances parame { Descriptor = descriptor; Job = job; - Parameters = parameters; + Parameters = parameters ?? ParameterInstances.Empty; Config = config; } diff --git a/src/BenchmarkDotNet/Running/BuildPartition.cs b/src/BenchmarkDotNet/Running/BuildPartition.cs index 4baff0aa0d..38bb8c53be 100644 --- a/src/BenchmarkDotNet/Running/BuildPartition.cs +++ b/src/BenchmarkDotNet/Running/BuildPartition.cs @@ -25,6 +25,8 @@ public class BuildPartition // assuming there are fewer than 4 billion build partitions (a safe assumption). internal static int s_partitionCounter; + internal static readonly BuildPartition Empty = new(); + public BuildPartition(BenchmarkBuildInfo[] benchmarks, IResolver resolver) { Resolver = resolver; @@ -35,6 +37,14 @@ public BuildPartition(BenchmarkBuildInfo[] benchmarks, IResolver resolver) GenerateMSBuildBinLog = benchmarks[0].Config.Options.IsSet(ConfigOptions.GenerateMSBuildBinLog); } + private BuildPartition() + { + Resolver = default!; + RepresentativeBenchmarkCase = default!; + Benchmarks = []; + ProgramName = default!; + } + public BenchmarkBuildInfo[] Benchmarks { get; } public string ProgramName { get; } diff --git a/src/BenchmarkDotNet/Toolchains/ArtifactsPaths.cs b/src/BenchmarkDotNet/Toolchains/ArtifactsPaths.cs index 033a531f5a..4358aca4ce 100644 --- a/src/BenchmarkDotNet/Toolchains/ArtifactsPaths.cs +++ b/src/BenchmarkDotNet/Toolchains/ArtifactsPaths.cs @@ -1,5 +1,8 @@ +using BenchmarkDotNet.Extensions; using JetBrains.Annotations; +#nullable enable + namespace BenchmarkDotNet.Toolchains { public class ArtifactsPaths @@ -36,15 +39,15 @@ public ArtifactsPaths( RootArtifactsFolderPath = rootArtifactsFolderPath; BuildArtifactsDirectoryPath = buildArtifactsDirectoryPath; BinariesDirectoryPath = binariesDirectoryPath; - PublishDirectoryPath = publishDirectoryPath; - ProgramCodePath = programCodePath; - AppConfigPath = appConfigPath; - NuGetConfigPath = nuGetConfigPath; - ProjectFilePath = projectFilePath; - BuildScriptFilePath = buildScriptFilePath; + PublishDirectoryPath = publishDirectoryPath.EnsureNotNull(); + ProgramCodePath = programCodePath.EnsureNotNull(); + AppConfigPath = appConfigPath.EnsureNotNull(); + NuGetConfigPath = nuGetConfigPath.EnsureNotNull(); + ProjectFilePath = projectFilePath.EnsureNotNull(); + BuildScriptFilePath = buildScriptFilePath.EnsureNotNull(); ExecutablePath = executablePath; ProgramName = programName; - PackagesDirectoryName = packagesDirectoryName; + PackagesDirectoryName = packagesDirectoryName.EnsureNotNull(); } } } \ No newline at end of file diff --git a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunGenerator.cs b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunGenerator.cs index f7108c9906..17ce4c1a67 100644 --- a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunGenerator.cs @@ -2,12 +2,14 @@ using System.Linq; using BenchmarkDotNet.Toolchains.CsProj; +#nullable enable + namespace BenchmarkDotNet.Toolchains.CoreRun { public class CoreRunGenerator : CsProjGenerator { public CoreRunGenerator(FileInfo sourceCoreRun, FileInfo copyCoreRun, string targetFrameworkMoniker, string cliPath, string packagesPath) - : base(targetFrameworkMoniker, cliPath, packagesPath, runtimeFrameworkVersion: null) + : base(targetFrameworkMoniker, cliPath, packagesPath) { SourceCoreRun = sourceCoreRun; CopyCoreRun = copyCoreRun; @@ -27,14 +29,14 @@ protected override string GetBinariesDirectoryPath(string buildArtifactsDirector protected override void CopyAllRequiredFiles(ArtifactsPaths artifactsPaths) { if (NeedsCopy) - CopyFilesRecursively(SourceCoreRun.Directory, CopyCoreRun.Directory); + CopyFilesRecursively(SourceCoreRun.Directory!, CopyCoreRun.Directory!); base.CopyAllRequiredFiles(artifactsPaths); } protected override string[] GetArtifactsToCleanup(ArtifactsPaths artifactsPaths) => NeedsCopy - ? base.GetArtifactsToCleanup(artifactsPaths).Concat(new[] { CopyCoreRun.Directory.FullName }).ToArray() + ? base.GetArtifactsToCleanup(artifactsPaths).Concat([CopyCoreRun.Directory!.FullName]).ToArray() : base.GetArtifactsToCleanup(artifactsPaths); // source: https://stackoverflow.com/a/58779/5852046 diff --git a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunPublisher.cs b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunPublisher.cs index 276f198af7..7f3b034d58 100644 --- a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunPublisher.cs +++ b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunPublisher.cs @@ -11,7 +11,7 @@ namespace BenchmarkDotNet.Toolchains.CoreRun { - public class CoreRunPublisher(string tfm, FileInfo coreRun, FileInfo? customDotNetCliPath = null) : DotNetCliPublisher(tfm, customDotNetCliPath?.FullName) + public class CoreRunPublisher(string tfm, FileInfo coreRun, FileInfo? customDotNetCliPath = null) : DotNetCliPublisher(tfm, customDotNetCliPath?.FullName ?? "") { public override BuildResult Build(GenerateResult generateResult, BuildPartition buildPartition, ILogger logger) { diff --git a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunToolchain.cs b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunToolchain.cs index 43337cdd4a..61849b3710 100644 --- a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunToolchain.cs @@ -6,6 +6,8 @@ using BenchmarkDotNet.Toolchains.DotNetCli; using BenchmarkDotNet.Validators; +#nullable enable + namespace BenchmarkDotNet.Toolchains.CoreRun { public class CoreRunToolchain : IToolchain @@ -21,7 +23,8 @@ public class CoreRunToolchain : IToolchain /// the directory to restore packages to public CoreRunToolchain(FileInfo coreRun, bool createCopy = true, string targetFrameworkMoniker = "net8.0", - FileInfo? customDotNetCliPath = null, DirectoryInfo? restorePath = null, + FileInfo? customDotNetCliPath = null, + DirectoryInfo? restorePath = null, string displayName = "CoreRun") { if (coreRun == null) throw new ArgumentNullException(nameof(coreRun)); @@ -33,7 +36,7 @@ public CoreRunToolchain(FileInfo coreRun, bool createCopy = true, RestorePath = restorePath; Name = displayName; - Generator = new CoreRunGenerator(SourceCoreRun, CopyCoreRun, targetFrameworkMoniker, customDotNetCliPath?.FullName, restorePath?.FullName); + Generator = new CoreRunGenerator(SourceCoreRun, CopyCoreRun, targetFrameworkMoniker, customDotNetCliPath?.FullName ?? "", restorePath?.FullName ?? ""); Builder = new CoreRunPublisher(targetFrameworkMoniker, CopyCoreRun, customDotNetCliPath); Executor = new DotNetCliExecutor(customDotNetCliPath: CopyCoreRun.FullName); // instead of executing "dotnet $pathToDll" we do "CoreRun $pathToDll" } @@ -52,9 +55,9 @@ public CoreRunToolchain(FileInfo coreRun, bool createCopy = true, public FileInfo CopyCoreRun { get; } - public FileInfo CustomDotNetCliPath { get; } + public FileInfo? CustomDotNetCliPath { get; } - public DirectoryInfo RestorePath { get; } + public DirectoryInfo? RestorePath { get; } public override string ToString() => Name; @@ -76,17 +79,17 @@ private static FileInfo GetShadowCopyPath(FileInfo coreRunPath) { string randomSubfolderName = Guid.NewGuid().ToString(); - FileInfo coreRunCopy = coreRunPath.Directory.Parent != null + FileInfo coreRunCopy = coreRunPath.Directory!.Parent != null ? new FileInfo(Path.Combine(coreRunPath.Directory.Parent.FullName, randomSubfolderName, coreRunPath.Name)) : new FileInfo(Path.Combine(coreRunPath.Directory.FullName, randomSubfolderName, coreRunPath.Name)); // C:\CoreRun.exe case - if (!TryToCreateSubfolder(coreRunCopy.Directory)) + if (!TryToCreateSubfolder(coreRunCopy.Directory!)) { // we are most likely missing permissions to write to given folder (it can be readonly etc) // in such case, CoreRun copy is going to be stored in TEMP coreRunCopy = new FileInfo(Path.Combine(Path.GetTempPath(), randomSubfolderName, coreRunPath.Name)); - if (!TryToCreateSubfolder(coreRunCopy.Directory)) + if (!TryToCreateSubfolder(coreRunCopy.Directory!)) { // if even that is impossible, we return the original path and nothing is going to be copied return coreRunPath; diff --git a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjClassicNetToolchain.cs b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjClassicNetToolchain.cs index 2761bd7c2c..de25331ada 100644 --- a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjClassicNetToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjClassicNetToolchain.cs @@ -1,12 +1,15 @@ using System.Collections.Generic; using BenchmarkDotNet.Characteristics; using BenchmarkDotNet.Detectors; +using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Portability; using BenchmarkDotNet.Running; using BenchmarkDotNet.Toolchains.DotNetCli; using BenchmarkDotNet.Validators; using JetBrains.Annotations; +#nullable enable + namespace BenchmarkDotNet.Toolchains.CsProj { /// @@ -26,17 +29,25 @@ public class CsProjClassicNetToolchain : Toolchain internal string CustomDotNetCliPath { get; } - private CsProjClassicNetToolchain(string targetFrameworkMoniker, string name, string? packagesPath = null, string? customDotNetCliPath = null) + private CsProjClassicNetToolchain(string targetFrameworkMoniker, string name, string packagesPath = "", string customDotNetCliPath = "") : base(name, - new CsProjGenerator(targetFrameworkMoniker, customDotNetCliPath, packagesPath, runtimeFrameworkVersion: null, isNetCore: false), + new CsProjGenerator( + targetFrameworkMoniker, + customDotNetCliPath, + packagesPath, + isNetCore: false), new DotNetCliBuilder(targetFrameworkMoniker, customDotNetCliPath), new Executor()) { CustomDotNetCliPath = customDotNetCliPath; } - public static IToolchain From(string targetFrameworkMoniker, string? packagesPath = null, string? customDotNetCliPath = null) - => new CsProjClassicNetToolchain(targetFrameworkMoniker, targetFrameworkMoniker, packagesPath, customDotNetCliPath); + public static IToolchain From(string targetFrameworkMoniker, string packagesPath = "", string customDotNetCliPath = "") + => new CsProjClassicNetToolchain( + targetFrameworkMoniker, + name: targetFrameworkMoniker, + packagesPath.EnsureNotNull(), + customDotNetCliPath.EnsureNotNull()); public override IEnumerable Validate(BenchmarkCase benchmarkCase, IResolver resolver) { diff --git a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs index d8f0314726..b31b02b353 100644 --- a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs @@ -45,10 +45,10 @@ public class CsProjGenerator : DotNetCliGenerator, IEquatable public string RuntimeFrameworkVersion { get; } - public CsProjGenerator(string targetFrameworkMoniker, string cliPath, string packagesPath, string runtimeFrameworkVersion, bool isNetCore = true) + public CsProjGenerator(string targetFrameworkMoniker, string cliPath, string packagesPath, string runtimeFrameworkVersion = "", bool isNetCore = true) : base(targetFrameworkMoniker, cliPath, packagesPath, isNetCore) { - RuntimeFrameworkVersion = runtimeFrameworkVersion; + RuntimeFrameworkVersion = runtimeFrameworkVersion.EnsureNotNull(); } protected override string GetBuildArtifactsDirectoryPath(BuildPartition buildPartition, string programName) @@ -74,10 +74,10 @@ protected override void GenerateBuildScript(BuildPartition buildPartition, Artif string projectFilePath = GetProjectFilePath(buildPartition.RepresentativeBenchmarkCase.Descriptor.Type, NullLogger.Instance).FullName; var content = new StringBuilder(300) - .AppendLine($"call {CliPath ?? "dotnet"} {DotNetCliCommand.GetRestoreCommand(artifactsPaths, buildPartition, projectFilePath)}") - .AppendLine($"call {CliPath ?? "dotnet"} {DotNetCliCommand.GetBuildCommand(artifactsPaths, buildPartition, projectFilePath, TargetFrameworkMoniker)}") - .AppendLine($"call {CliPath ?? "dotnet"} {DotNetCliCommand.GetRestoreCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath)}") - .AppendLine($"call {CliPath ?? "dotnet"} {DotNetCliCommand.GetBuildCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath, TargetFrameworkMoniker)}") + .AppendLine($"call {CliPath} {DotNetCliCommand.GetRestoreCommand(artifactsPaths, buildPartition, projectFilePath)}") + .AppendLine($"call {CliPath} {DotNetCliCommand.GetBuildCommand(artifactsPaths, buildPartition, projectFilePath, TargetFrameworkMoniker)}") + .AppendLine($"call {CliPath} {DotNetCliCommand.GetRestoreCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath)}") + .AppendLine($"call {CliPath} {DotNetCliCommand.GetBuildCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath, TargetFrameworkMoniker)}") .ToString(); File.WriteAllText(artifactsPaths.BuildScriptFilePath, content); @@ -154,7 +154,7 @@ public static int Main(string[] args) CliPath, gathererProject, TargetFrameworkMoniker, - null, + arguments: "", GenerateResult.Success(artifactsPaths, []), logger, buildPartition, diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs index b637e3f943..86fbfb4c8f 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs @@ -11,6 +11,8 @@ using Microsoft.DotNet.PlatformAbstractions; #endif +#nullable enable + namespace BenchmarkDotNet.Toolchains.DotNetCli { [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -18,12 +20,14 @@ public abstract class CustomDotNetCliToolchainBuilder { protected readonly Dictionary Feeds = new Dictionary(); - protected string runtimeIdentifier, customDotNetCliPath; - protected string displayName; - protected string runtimeFrameworkVersion; + protected string? runtimeIdentifier; + protected string? customDotNetCliPath; + protected string? displayName; + protected string? runtimeFrameworkVersion; - protected bool useNuGetClearTag, useTempFolderForRestore; - private string targetFrameworkMoniker; + protected bool useNuGetClearTag; + protected bool useTempFolderForRestore; + private string? targetFrameworkMoniker; public abstract IToolchain ToToolchain(); diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliBuilder.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliBuilder.cs index 79773c7be0..f0f2065a4d 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliBuilder.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliBuilder.cs @@ -5,6 +5,8 @@ using BenchmarkDotNet.Toolchains.Results; using JetBrains.Annotations; +#nullable enable + namespace BenchmarkDotNet.Toolchains.DotNetCli { [PublicAPI] @@ -16,7 +18,7 @@ public class DotNetCliBuilder : IBuilder private bool LogOutput { get; } [PublicAPI] - public DotNetCliBuilder(string targetFrameworkMoniker, string? customDotNetCliPath = null, bool logOutput = false) + public DotNetCliBuilder(string targetFrameworkMoniker, string customDotNetCliPath = "", bool logOutput = false) { TargetFrameworkMoniker = targetFrameworkMoniker; CustomDotNetCliPath = customDotNetCliPath; diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs index bda01f9487..4b4f43cbac 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs @@ -13,6 +13,8 @@ using BenchmarkDotNet.Toolchains.Results; using JetBrains.Annotations; +#nullable enable + namespace BenchmarkDotNet.Toolchains.DotNetCli { public class DotNetCliCommand @@ -23,7 +25,7 @@ public class DotNetCliCommand [PublicAPI] public string TargetFrameworkMoniker { get; } - [PublicAPI] public string? Arguments { get; } + [PublicAPI] public string Arguments { get; } [PublicAPI] public GenerateResult GenerateResult { get; } @@ -31,14 +33,14 @@ public class DotNetCliCommand [PublicAPI] public BuildPartition BuildPartition { get; } - [PublicAPI] public IReadOnlyList? EnvironmentVariables { get; } + [PublicAPI] public IReadOnlyList EnvironmentVariables { get; } [PublicAPI] public TimeSpan Timeout { get; } [PublicAPI] public bool LogOutput { get; } - public DotNetCliCommand(string cliPath, string filePath, string tfm, string? arguments, GenerateResult generateResult, ILogger logger, - BuildPartition buildPartition, IReadOnlyList? environmentVariables, TimeSpan timeout, bool logOutput = false) + public DotNetCliCommand(string cliPath, string filePath, string tfm, string arguments, GenerateResult generateResult, ILogger logger, + BuildPartition buildPartition, IReadOnlyList environmentVariables, TimeSpan timeout, bool logOutput = false) { CliPath = cliPath.IsBlank() ? DotNetCliCommandExecutor.DefaultDotNetCliPath.Value : cliPath; Arguments = arguments; @@ -47,12 +49,12 @@ public DotNetCliCommand(string cliPath, string filePath, string tfm, string? arg GenerateResult = generateResult; Logger = logger; BuildPartition = buildPartition; - EnvironmentVariables = environmentVariables; + EnvironmentVariables = environmentVariables ?? []; Timeout = timeout; - LogOutput = logOutput || (buildPartition is not null && buildPartition.LogBuildOutput); + LogOutput = logOutput || buildPartition.LogBuildOutput; } - public DotNetCliCommand WithArguments(string? arguments) + public DotNetCliCommand WithArguments(string arguments) => new(CliPath, FilePath, TargetFrameworkMoniker, arguments, GenerateResult, Logger, BuildPartition, EnvironmentVariables, Timeout, LogOutput); public DotNetCliCommand WithCliPath(string cliPath) @@ -61,7 +63,7 @@ public DotNetCliCommand WithCliPath(string cliPath) [PublicAPI] public BuildResult RestoreThenBuild() { - DotNetCliCommandExecutor.LogEnvVars(WithArguments(null)); + DotNetCliCommandExecutor.LogEnvVars(WithArguments("")); // there is no way to do tell dotnet restore which configuration to use (https://github.com/NuGet/Home/issues/5119) // so when users go with custom build configuration, we must perform full build @@ -97,7 +99,7 @@ public BuildResult RestoreThenBuild() [PublicAPI] public BuildResult RestoreThenBuildThenPublish() { - DotNetCliCommandExecutor.LogEnvVars(WithArguments(null)); + DotNetCliCommandExecutor.LogEnvVars(WithArguments("")); // there is no way to do tell dotnet restore which configuration to use (https://github.com/NuGet/Home/issues/5119) // so when users go with custom build configuration, we must perform full publish @@ -186,7 +188,7 @@ private static string GetMsBuildBinLogArgument(BuildPartition buildPartition, st private static string GetCustomMsBuildArguments(BenchmarkCase benchmarkCase, IResolver resolver) { if (!benchmarkCase.Job.HasValue(InfrastructureMode.ArgumentsCharacteristic)) - return null; + return ""; var msBuildArguments = benchmarkCase.Job.ResolveValue(InfrastructureMode.ArgumentsCharacteristic, resolver)!.OfType(); diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs index 38511b152c..85a5995b2d 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs @@ -11,8 +11,12 @@ using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Loggers; using BenchmarkDotNet.Portability; +using BenchmarkDotNet.Running; +using BenchmarkDotNet.Toolchains.Results; using JetBrains.Annotations; +#nullable enable + namespace BenchmarkDotNet.Toolchains.DotNetCli { [PublicAPI] @@ -23,7 +27,7 @@ public static class DotNetCliCommandExecutor [PublicAPI] public static DotNetCliCommandResult Execute(DotNetCliCommand parameters) { - using (var process = new Process { StartInfo = BuildStartInfo(parameters.CliPath, parameters.GenerateResult?.ArtifactsPaths.BuildArtifactsDirectoryPath, parameters.Arguments, parameters.EnvironmentVariables) }) + using (var process = new Process { StartInfo = BuildStartInfo(parameters.CliPath, parameters.GenerateResult.ArtifactsPaths.BuildArtifactsDirectoryPath, parameters.Arguments, parameters.EnvironmentVariables) }) using (var outputReader = new AsyncProcessOutputReader(process, parameters.LogOutput, parameters.Logger)) using (new ConsoleExitHandler(process, parameters.Logger)) { @@ -162,9 +166,9 @@ internal static string GetSdkPath(string cliPath) filePath: string.Empty, tfm: string.Empty, arguments: "--info", - generateResult: null, + generateResult: GenerateResult.Success(ArtifactsPaths.Empty, []), logger: NullLogger.Instance, - buildPartition: null, + buildPartition: BuildPartition.Empty, environmentVariables: [], timeout: TimeSpan.FromMinutes(1), logOutput: false); diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliGenerator.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliGenerator.cs index 5e8c172779..6719028cbd 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliGenerator.cs @@ -3,9 +3,12 @@ using System.IO; using System.Linq; using System.Text; +using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Running; using JetBrains.Annotations; +#nullable enable + namespace BenchmarkDotNet.Toolchains.DotNetCli { [PublicAPI] @@ -27,8 +30,8 @@ public abstract class DotNetCliGenerator : GeneratorBase protected DotNetCliGenerator(string targetFrameworkMoniker, string cliPath, string packagesPath, bool isNetCore) { TargetFrameworkMoniker = targetFrameworkMoniker; - CliPath = cliPath; - PackagesPath = packagesPath; + CliPath = cliPath.IsBlank() ? "dotnet" : cliPath; + PackagesPath = packagesPath.EnsureNotNull(); IsNetCore = isNetCore; } @@ -104,8 +107,8 @@ protected override void CopyAllRequiredFiles(ArtifactsPaths artifactsPaths) protected override void GenerateBuildScript(BuildPartition buildPartition, ArtifactsPaths artifactsPaths) { var content = new StringBuilder(300) - .AppendLine($"call {CliPath ?? "dotnet"} {DotNetCliCommand.GetRestoreCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath)}") - .AppendLine($"call {CliPath ?? "dotnet"} {DotNetCliCommand.GetBuildCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath, TargetFrameworkMoniker)}") + .AppendLine($"call {CliPath} {DotNetCliCommand.GetRestoreCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath)}") + .AppendLine($"call {CliPath} {DotNetCliCommand.GetBuildCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath, TargetFrameworkMoniker)}") .ToString(); File.WriteAllText(artifactsPaths.BuildScriptFilePath, content); diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliPublisher.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliPublisher.cs index 35f375cbd1..5e3b2a103e 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliPublisher.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliPublisher.cs @@ -1,27 +1,47 @@ using System.Collections.Generic; +using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Loggers; using BenchmarkDotNet.Running; using BenchmarkDotNet.Toolchains.Results; +#nullable enable + namespace BenchmarkDotNet.Toolchains.DotNetCli; -public class DotNetCliPublisher(string tfm, string? customDotNetCliPath = null, string? extraArguments = null, IReadOnlyList? environmentVariables = null, bool logOutput = false) : IBuilder +public class DotNetCliPublisher : IBuilder { - public string TargetFrameworkMoniker { get; } = tfm; - public string CustomDotNetCliPath { get; } = customDotNetCliPath; + public string TargetFrameworkMoniker { get; } + public string CustomDotNetCliPath { get; } + public string ExtraArguments { get; } + public IReadOnlyList EnvironmentVariables { get; } + public bool LogOutput{ get; } + + public DotNetCliPublisher( + string tfm, + string customDotNetCliPath = "", + string extraArguments = "", + IReadOnlyList? environmentVariables = null, + bool logOutput = false) + { + TargetFrameworkMoniker = tfm; + CustomDotNetCliPath = customDotNetCliPath.EnsureNotNull(); + ExtraArguments = extraArguments.EnsureNotNull(); + EnvironmentVariables = environmentVariables ?? []; + LogOutput = logOutput; + } public virtual BuildResult Build(GenerateResult generateResult, BuildPartition buildPartition, ILogger logger) => new DotNetCliCommand( CustomDotNetCliPath, generateResult.ArtifactsPaths.ProjectFilePath, TargetFrameworkMoniker, - extraArguments, + ExtraArguments, generateResult, logger, buildPartition, - environmentVariables, + EnvironmentVariables, buildPartition.Timeout, - logOutput: logOutput + logOutput: LogOutput ).RestoreThenBuildThenPublish(); } diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs index c21642b055..34e8d5d0e5 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs @@ -1,6 +1,10 @@ +using BenchmarkDotNet.ConsoleArguments; +using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Toolchains.MonoAotLLVM; using JetBrains.Annotations; +#nullable enable + namespace BenchmarkDotNet.Toolchains.DotNetCli { /// @@ -9,18 +13,18 @@ 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 NetCoreApp11_0 = new("net11.0", null, ".NET 11.0"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp20 = new("netcoreapp2.0", ".NET Core 2.0"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp21 = new("netcoreapp2.1", ".NET Core 2.1"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp22 = new("netcoreapp2.2", ".NET Core 2.2"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp30 = new("netcoreapp3.0", ".NET Core 3.0"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp31 = new("netcoreapp3.1", ".NET Core 3.1"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp50 = new("net5.0", ".NET 5.0"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp60 = new("net6.0", ".NET 6.0"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp70 = new("net7.0", ".NET 7.0"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp80 = new("net8.0", ".NET 8.0"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp90 = new("net9.0", ".NET 9.0"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp10_0 = new("net10.0", ".NET 10.0"); + [PublicAPI] public static readonly NetCoreAppSettings NetCoreApp11_0 = new("net11.0", ".NET 11.0"); /// /// @@ -35,7 +39,7 @@ public class NetCoreAppSettings /// /// /// customize dotnet cli path if default is not desired - /// simply ignored if null + /// simply ignored if null or empty /// /// the directory to restore packages to /// path to a custom runtime pack @@ -45,54 +49,79 @@ public class NetCoreAppSettings [PublicAPI] public NetCoreAppSettings( string targetFrameworkMoniker, - string? runtimeFrameworkVersion, + string runtimeFrameworkVersion, string name, - string? customDotNetCliPath = null, - string? packagesPath = null, - string? customRuntimePack = null, - string? aotCompilerPath = null, + string customDotNetCliPath = "", + string packagesPath = "", + string customRuntimePack = "", + string aotCompilerPath = "", MonoAotCompilerMode aotCompilerMode = MonoAotCompilerMode.mini ) { TargetFrameworkMoniker = targetFrameworkMoniker; - RuntimeFrameworkVersion = runtimeFrameworkVersion; + RuntimeFrameworkVersion = runtimeFrameworkVersion.EnsureNotNull(); Name = name; - CustomDotNetCliPath = customDotNetCliPath; - PackagesPath = packagesPath; - CustomRuntimePack = customRuntimePack; - AOTCompilerPath = aotCompilerPath; + CustomDotNetCliPath = customDotNetCliPath.EnsureNotNull(); + PackagesPath = packagesPath.EnsureNotNull(); + CustomRuntimePack = customRuntimePack.EnsureNotNull(); + AOTCompilerPath = aotCompilerPath.EnsureNotNull(); AOTCompilerMode = aotCompilerMode; } + /// + /// Internal constructor that accept CommandLineOptions + /// + internal NetCoreAppSettings( + string targetFrameworkMoniker, + string runtimeFrameworkVersion, + string name, + CommandLineOptions options) + : this( + targetFrameworkMoniker, + runtimeFrameworkVersion: runtimeFrameworkVersion, + name: name, + customDotNetCliPath: options.CliPath?.FullName ?? "", + packagesPath: options.RestorePath?.FullName ?? "", + customRuntimePack: options.CustomRuntimePack ?? "", + aotCompilerPath: options.AOTCompilerPath?.ToString() ?? "", + aotCompilerMode: options.AOTCompilerMode) + { + } + + internal NetCoreAppSettings(string targetFrameworkMoniker, string name) + : this(targetFrameworkMoniker, runtimeFrameworkVersion: "", name) + { + } + /// /// sample values: net6.0, net8.0 /// public string TargetFrameworkMoniker { get; } - public string? RuntimeFrameworkVersion { get; } + public string RuntimeFrameworkVersion { get; } /// /// display name used for showing the results /// public string Name { get; } - public string? CustomDotNetCliPath { get; } + public string CustomDotNetCliPath { get; } /// /// The directory to restore packages to. /// - public string? PackagesPath { get; } + public string PackagesPath { get; } /// /// Path to a custom runtime pack. /// - public string? CustomRuntimePack { get; } + public string CustomRuntimePack { get; } /// /// Path to the Mono AOT Compiler /// - public string? AOTCompilerPath { get; } + public string AOTCompilerPath { get; } /// /// Mono AOT Compiler mode, either 'mini' or 'llvm' diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReflectionHelpers.cs b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReflectionHelpers.cs index eee839ee40..7cde650e44 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReflectionHelpers.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReflectionHelpers.cs @@ -5,6 +5,8 @@ using BenchmarkDotNet.Running; using static BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation.RunnableConstants; +#nullable enable + namespace BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation { internal static class RunnableReflectionHelpers @@ -15,7 +17,7 @@ internal static class RunnableReflectionHelpers public const BindingFlags BindingFlagsAllStatic = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static; public const BindingFlags BindingFlagsAllInstance = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; - private static object TryChangeType(object value, Type targetType) + private static object? TryChangeType(object? value, Type targetType) { try { @@ -31,7 +33,7 @@ private static object TryChangeType(object value, Type targetType) { var implicitOp = GetImplicitConversionOpFromTo(value.GetType(), targetType); if (implicitOp != null) - return implicitOp.Invoke(null, new[] { value }); + return implicitOp.Invoke(null, [value])!; } return value; @@ -43,13 +45,13 @@ public static bool IsRefLikeType(Type t) && t.GetCustomAttributes().Any(a => a.GetType().FullName == IsByRefLikeAttributeTypeName); } - public static MethodInfo GetImplicitConversionOpFromTo(Type from, Type to) + public static MethodInfo? GetImplicitConversionOpFromTo(Type from, Type to) { return GetImplicitConversionOpCore(to, from, to) ?? GetImplicitConversionOpCore(from, from, to); } - private static MethodInfo GetImplicitConversionOpCore(Type owner, Type from, Type to) + private static MethodInfo? GetImplicitConversionOpCore(Type owner, Type from, Type to) { return owner.GetMethods(BindingFlagsPublicStatic) .FirstOrDefault(m => @@ -66,12 +68,7 @@ int argIndex ) where T : notnull { - var argValue = benchmarkCase.Parameters.GetArgument(argInfo.Name); - if (argValue == null) - { - throw new InvalidOperationException($"Can't find arg member for {argInfo.Name}."); - } - + var argValue = benchmarkCase.Parameters.GetArgument(argInfo.Name!); var type = instance.GetType(); var argName = ArgFieldPrefix + argIndex; if (type.GetField(argName, BindingFlagsNonPublicInstance) is var f && f != null) @@ -129,7 +126,7 @@ private static TResult GetFieldValueCore(T instance, string memberNa if (result == null) throw new InvalidOperationException($"Can't find a member {memberName}."); - return (TResult)result.GetValue(instance); + return (TResult)result.GetValue(instance)!; // TODO: Currently this method is used to get Action field and assume it's not null. } private static TDelegate GetDelegateCore(T instance, string memberName) diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitGenerator.cs b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitGenerator.cs index d192f10da8..0f855a0cae 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitGenerator.cs @@ -6,6 +6,8 @@ using System.Collections.Generic; using System.IO; +#nullable enable + namespace BenchmarkDotNet.Toolchains.InProcess.Emit { public class InProcessEmitGenerator : IGenerator @@ -47,15 +49,15 @@ private ArtifactsPaths GetArtifactsPaths(BuildPartition buildPartition, string r rootArtifactsFolderPath: rootArtifactsFolderPath, buildArtifactsDirectoryPath: buildArtifactsDirectoryPath, binariesDirectoryPath: binariesDirectoryPath, - publishDirectoryPath: null, - programCodePath: null, - appConfigPath: null, - nuGetConfigPath: null, - projectFilePath: null, - buildScriptFilePath: null, + publishDirectoryPath: "", + programCodePath: "", + appConfigPath: "", + nuGetConfigPath: "", + projectFilePath: "", + buildScriptFilePath: "", executablePath: executablePath, programName: programName, - packagesDirectoryName: null); + packagesDirectoryName: ""); } } } \ No newline at end of file diff --git a/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs b/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs index 009ed0b9b5..6e8ad948f4 100644 --- a/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs @@ -3,14 +3,16 @@ using JetBrains.Annotations; using System; +#nullable enable + namespace BenchmarkDotNet.Toolchains.Mono { [PublicAPI] public class MonoToolchain : CsProjCoreToolchain, IEquatable { - [PublicAPI] public static readonly IToolchain Mono60 = From(new NetCoreAppSettings("net6.0", null, "mono60")); - [PublicAPI] public static readonly IToolchain Mono70 = From(new NetCoreAppSettings("net7.0", null, "mono70")); - [PublicAPI] public static readonly IToolchain Mono80 = From(new NetCoreAppSettings("net8.0", null, "mono80")); + [PublicAPI] public static readonly IToolchain Mono60 = From(new NetCoreAppSettings("net6.0", "mono60")); + [PublicAPI] public static readonly IToolchain Mono70 = From(new NetCoreAppSettings("net7.0", "mono70")); + [PublicAPI] public static readonly IToolchain Mono80 = From(new NetCoreAppSettings("net8.0", "mono80")); private MonoToolchain(string name, IGenerator generator, IBuilder builder, IExecutor executor, string customDotNetCliPath) : base(name, generator, builder, executor, customDotNetCliPath) @@ -25,9 +27,17 @@ private MonoToolchain(string name, IGenerator generator, IBuilder builder, IExec new DotNetCliExecutor(settings.CustomDotNetCliPath), settings.CustomDotNetCliPath); - public override bool Equals(object obj) => obj is MonoToolchain typed && Equals(typed); + public override bool Equals(object? obj) => obj is MonoToolchain typed && Equals(typed); + + public bool Equals(MonoToolchain? other) + { + if (ReferenceEquals(null, other)) + return false; + if (ReferenceEquals(this, other)) + return true; - public bool Equals(MonoToolchain other) => Generator.Equals(other.Generator); + return Generator.Equals(other.Generator); + } public override int GetHashCode() => Generator.GetHashCode(); } diff --git a/src/BenchmarkDotNet/Toolchains/MonoAotLLVM/MonoAotLLVMGenerator.cs b/src/BenchmarkDotNet/Toolchains/MonoAotLLVM/MonoAotLLVMGenerator.cs index c81e14f669..7719f4e8a4 100644 --- a/src/BenchmarkDotNet/Toolchains/MonoAotLLVM/MonoAotLLVMGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/MonoAotLLVM/MonoAotLLVMGenerator.cs @@ -9,6 +9,8 @@ using BenchmarkDotNet.Toolchains.CsProj; using BenchmarkDotNet.Toolchains.DotNetCli; +#nullable enable + namespace BenchmarkDotNet.Toolchains.MonoAotLLVM { public class MonoAotLLVMGenerator : CsProjGenerator @@ -18,7 +20,7 @@ public class MonoAotLLVMGenerator : CsProjGenerator private readonly MonoAotCompilerMode AotCompilerMode; public MonoAotLLVMGenerator(string targetFrameworkMoniker, string cliPath, string packagesPath, string customRuntimePack, string aotCompilerPath, MonoAotCompilerMode aotCompilerMode) - : base(targetFrameworkMoniker, cliPath, packagesPath, runtimeFrameworkVersion: null) + : base(targetFrameworkMoniker, cliPath, packagesPath) { CustomRuntimePack = customRuntimePack; AotCompilerPath = aotCompilerPath; @@ -45,7 +47,7 @@ protected override void GenerateProject(BuildPartition buildPartition, Artifacts .Replace("$PROGRAMNAME$", artifactsPaths.ProgramName) .Replace("$COPIEDSETTINGS$", customProperties) .Replace("$SDKNAME$", sdkName) - .Replace("$RUNTIMEPACK$", CustomRuntimePack ?? "") + .Replace("$RUNTIMEPACK$", CustomRuntimePack) .Replace("$COMPILERBINARYPATH$", AotCompilerPath) .Replace("$RUNTIMEIDENTIFIER$", CustomDotNetCliToolchainBuilder.GetPortableRuntimeIdentifier()) .Replace("$USELLVM$", useLLVM) diff --git a/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmGenerator.cs b/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmGenerator.cs index 5619e9ce76..2b2dffd453 100644 --- a/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmGenerator.cs @@ -8,6 +8,8 @@ using BenchmarkDotNet.Running; using BenchmarkDotNet.Toolchains.CsProj; +#nullable enable + namespace BenchmarkDotNet.Toolchains.MonoWasm { public class WasmGenerator : CsProjGenerator @@ -16,7 +18,7 @@ public class WasmGenerator : CsProjGenerator private const string MainJS = "benchmark-main.mjs"; public WasmGenerator(string targetFrameworkMoniker, string cliPath, string packagesPath, string customRuntimePack, bool aot) - : base(targetFrameworkMoniker, cliPath, packagesPath, runtimeFrameworkVersion: null) + : base(targetFrameworkMoniker, cliPath, packagesPath) { CustomRuntimePack = customRuntimePack; BenchmarkRunCallType = aot ? Code.CodeGenBenchmarkRunCallType.Direct : Code.CodeGenBenchmarkRunCallType.Reflection; @@ -59,7 +61,7 @@ protected void GenerateProjectFile(BuildPartition buildPartition, ArtifactsPaths .Replace("$COPIEDSETTINGS$", customProperties) .Replace("$SDKNAME$", sdkName) .Replace("$WASMDATADIR$", runtime.WasmDataDir) - .Replace("$TARGET$", CustomRuntimePack != null ? "PublishWithCustomRuntimePack" : "Publish") + .Replace("$TARGET$", CustomRuntimePack.IsNotBlank() ? "PublishWithCustomRuntimePack" : "Publish") .ToString(); File.WriteAllText(artifactsPaths.ProjectFilePath, content); diff --git a/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs b/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs index 49a8008339..f062ac86cd 100644 --- a/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs +++ b/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs @@ -31,11 +31,18 @@ public class Generator : CsProjGenerator internal const string GeneratedRdXmlFileName = "bdn_generated.rd.xml"; internal Generator(string ilCompilerVersion, - string runtimeFrameworkVersion, string targetFrameworkMoniker, string cliPath, - string runtimeIdentifier, IReadOnlyDictionary feeds, bool useNuGetClearTag, - bool useTempFolderForRestore, string packagesRestorePath, - bool rootAllApplicationAssemblies, bool ilcGenerateStackTraceData, - string ilcOptimizationPreference, string ilcInstructionSet) + string runtimeFrameworkVersion, + string targetFrameworkMoniker, + string cliPath, + string runtimeIdentifier, + IReadOnlyDictionary feeds, + bool useNuGetClearTag, + bool useTempFolderForRestore, + string packagesRestorePath, + bool rootAllApplicationAssemblies, + bool ilcGenerateStackTraceData, + string ilcOptimizationPreference, + string ilcInstructionSet) : base(targetFrameworkMoniker, cliPath, GetPackagesDirectoryPath(useTempFolderForRestore, packagesRestorePath), runtimeFrameworkVersion) { this.ilCompilerVersion = ilCompilerVersion; @@ -76,10 +83,10 @@ protected override void GenerateBuildScript(BuildPartition buildPartition, Artif string extraArguments = NativeAotToolchain.GetExtraArguments(runtimeIdentifier); var content = new StringBuilder(300) - .AppendLine($"call {CliPath ?? "dotnet"} {DotNetCliCommand.GetRestoreCommand(artifactsPaths, buildPartition, projectFilePath, extraArguments)}") - .AppendLine($"call {CliPath ?? "dotnet"} {DotNetCliCommand.GetPublishCommand(artifactsPaths, buildPartition, projectFilePath, TargetFrameworkMoniker, extraArguments)}") - .AppendLine($"call {CliPath ?? "dotnet"} {DotNetCliCommand.GetRestoreCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath, extraArguments)}") - .AppendLine($"call {CliPath ?? "dotnet"} {DotNetCliCommand.GetPublishCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath, TargetFrameworkMoniker, extraArguments)}") + .AppendLine($"call {CliPath} {DotNetCliCommand.GetRestoreCommand(artifactsPaths, buildPartition, projectFilePath, extraArguments)}") + .AppendLine($"call {CliPath} {DotNetCliCommand.GetPublishCommand(artifactsPaths, buildPartition, projectFilePath, TargetFrameworkMoniker, extraArguments)}") + .AppendLine($"call {CliPath} {DotNetCliCommand.GetRestoreCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath, extraArguments)}") + .AppendLine($"call {CliPath} {DotNetCliCommand.GetPublishCommand(artifactsPaths, buildPartition, artifactsPaths.ProjectFilePath, TargetFrameworkMoniker, extraArguments)}") .ToString(); File.WriteAllText(artifactsPaths.BuildScriptFilePath, content); @@ -90,7 +97,9 @@ protected override void GenerateBuildScript(BuildPartition buildPartition, Artif // some of the packages are going to contain source code, so they can not be in the subfolder of current solution // otherwise they would be compiled too (new .csproj include all .cs files from subfolders by default private static string GetPackagesDirectoryPath(bool useTempFolderForRestore, string packagesRestorePath) - => packagesRestorePath ?? (useTempFolderForRestore ? Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()) : ""); + => packagesRestorePath.IsBlank() && useTempFolderForRestore + ? Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()) + : ""; protected override string[] GetArtifactsToCleanup(ArtifactsPaths artifactsPaths) => useTempFolderForRestore && artifactsPaths.PackagesDirectoryName.IsNotBlank() @@ -191,8 +200,13 @@ private string GetTrimmingSettings() private string GetInstructionSetSettings(BuildPartition buildPartition) { - string instructionSet = ilcInstructionSet ?? GetCurrentInstructionSet(buildPartition.Platform); - return instructionSet.IsNotBlank() ? $"{instructionSet}" : ""; + string instructionSet = ilcInstructionSet.IsBlank() + ? GetCurrentInstructionSet(buildPartition.Platform) + : ilcInstructionSet; + + return instructionSet.IsNotBlank() + ? $"{instructionSet}" + : ""; } public IEnumerable GetRdXmlFiles(Type benchmarkTarget, ILogger logger) diff --git a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs index da92e9951c..6c27fc7522 100644 --- a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs @@ -4,6 +4,8 @@ using BenchmarkDotNet.Toolchains.DotNetCli; using BenchmarkDotNet.Validators; +#nullable enable + namespace BenchmarkDotNet.Toolchains.NativeAot { public class NativeAotToolchain : Toolchain diff --git a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs index f394516d3e..a56c479408 100644 --- a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs +++ b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs @@ -5,19 +5,21 @@ using BenchmarkDotNet.Toolchains.DotNetCli; using JetBrains.Annotations; +#nullable enable + namespace BenchmarkDotNet.Toolchains.NativeAot { public class NativeAotToolchainBuilder : CustomDotNetCliToolchainBuilder { public static NativeAotToolchainBuilder Create() => new NativeAotToolchainBuilder(); - private string ilCompilerVersion; - private string packagesRestorePath; + private string? ilCompilerVersion; + private string? packagesRestorePath; // we set those default values on purpose https://github.com/dotnet/BenchmarkDotNet/pull/1057#issuecomment-461832612 private bool rootAllApplicationAssemblies; private bool ilcGenerateStackTraceData = true; private string ilcOptimizationPreference = "Speed"; - private string? ilcInstructionSet = null; + private string? ilcInstructionSet; private bool isIlCompilerConfigured; @@ -137,20 +139,20 @@ public override IToolchain ToToolchain() throw new InvalidOperationException("You need to use UseNuGet or UseLocalBuild methods to tell us which ILCompiler to use."); return new NativeAotToolchain( - displayName: displayName, - ilCompilerVersion: ilCompilerVersion, - runtimeFrameworkVersion: runtimeFrameworkVersion, + displayName: displayName!, + ilCompilerVersion: ilCompilerVersion!, + runtimeFrameworkVersion: runtimeFrameworkVersion ?? "", targetFrameworkMoniker: GetTargetFrameworkMoniker(), runtimeIdentifier: runtimeIdentifier ?? GetPortableRuntimeIdentifier(), - customDotNetCliPath: customDotNetCliPath, - packagesRestorePath: packagesRestorePath, + customDotNetCliPath: customDotNetCliPath ?? "", + packagesRestorePath: packagesRestorePath ?? "", feeds: Feeds, useNuGetClearTag: useNuGetClearTag, useTempFolderForRestore: useTempFolderForRestore, rootAllApplicationAssemblies: rootAllApplicationAssemblies, ilcGenerateStackTraceData: ilcGenerateStackTraceData, ilcOptimizationPreference: ilcOptimizationPreference, - ilcInstructionSet: ilcInstructionSet + ilcInstructionSet: ilcInstructionSet ?? "" ); } } diff --git a/src/BenchmarkDotNet/Toolchains/R2R/R2RGenerator.cs b/src/BenchmarkDotNet/Toolchains/R2R/R2RGenerator.cs index c5d35653d6..7da862e9a1 100644 --- a/src/BenchmarkDotNet/Toolchains/R2R/R2RGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/R2R/R2RGenerator.cs @@ -9,6 +9,8 @@ using BenchmarkDotNet.Toolchains.CsProj; using BenchmarkDotNet.Toolchains.DotNetCli; +#nullable enable + namespace BenchmarkDotNet.Toolchains.R2R { public class R2RGenerator : CsProjGenerator @@ -17,7 +19,7 @@ public class R2RGenerator : CsProjGenerator private readonly string Crossgen2Pack; public R2RGenerator(string targetFrameworkMoniker, string cliPath, string packagesPath, string customRuntimePack, string crossgen2Pack) - : base(targetFrameworkMoniker, cliPath, packagesPath, runtimeFrameworkVersion: null) + : base(targetFrameworkMoniker, cliPath, packagesPath) { CustomRuntimePack = customRuntimePack; Crossgen2Pack = crossgen2Pack; diff --git a/src/BenchmarkDotNet/Toolchains/R2R/R2RToolchain.cs b/src/BenchmarkDotNet/Toolchains/R2R/R2RToolchain.cs index 02dcb41358..4cb37d81ef 100644 --- a/src/BenchmarkDotNet/Toolchains/R2R/R2RToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/R2R/R2RToolchain.cs @@ -7,15 +7,17 @@ using System; using System.Collections.Generic; +#nullable enable + namespace BenchmarkDotNet.Toolchains.R2R { [PublicAPI] public class R2RToolchain : CsProjCoreToolchain, IEquatable { - [PublicAPI] public static readonly IToolchain R2R80 = From(new NetCoreAppSettings("net8.0", null, "R2R 8.0")); - [PublicAPI] public static readonly IToolchain R2R90 = From(new NetCoreAppSettings("net9.0", null, "R2R 9.0")); - [PublicAPI] public static readonly IToolchain R2R10_0 = From(new NetCoreAppSettings("net10.0", null, "R2R 10.0")); - [PublicAPI] public static readonly IToolchain R2R11_0 = From(new NetCoreAppSettings("net11.0", null, "R2R 11.0")); + [PublicAPI] public static readonly IToolchain R2R80 = From(new NetCoreAppSettings("net8.0", "R2R 8.0")); + [PublicAPI] public static readonly IToolchain R2R90 = From(new NetCoreAppSettings("net9.0", "R2R 9.0")); + [PublicAPI] public static readonly IToolchain R2R10_0 = From(new NetCoreAppSettings("net10.0", "R2R 10.0")); + [PublicAPI] public static readonly IToolchain R2R11_0 = From(new NetCoreAppSettings("net11.0", "R2R 11.0")); private readonly string _customDotNetCliPath; private R2RToolchain(string name, IGenerator generator, IBuilder builder, IExecutor executor, string customDotNetCliPath) diff --git a/src/BenchmarkDotNet/Toolchains/Results/BuildResult.cs b/src/BenchmarkDotNet/Toolchains/Results/BuildResult.cs index 205b9d321f..2883935956 100644 --- a/src/BenchmarkDotNet/Toolchains/Results/BuildResult.cs +++ b/src/BenchmarkDotNet/Toolchains/Results/BuildResult.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using BenchmarkDotNet.Toolchains.DotNetCli; using JetBrains.Annotations; @@ -33,6 +34,6 @@ public static BuildResult Failure(GenerateResult generateResult, Exception excep public override string ToString() => "BuildResult: " + (IsBuildSuccess ? "Success" : "Failure"); - internal bool TryToExplainFailureReason(out string? reason) => MsBuildErrorMapper.TryToExplainFailureReason(this, out reason); + internal bool TryToExplainFailureReason([NotNullWhen(true)] out string? reason) => MsBuildErrorMapper.TryToExplainFailureReason(this, out reason); } } \ No newline at end of file diff --git a/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs b/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs index 791afbb562..57bb335d88 100644 --- a/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs +++ b/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs @@ -76,13 +76,13 @@ bool UseRoslyn() RuntimeMoniker.Mono60 => GetToolchain(RuntimeMoniker.Net60), RuntimeMoniker.Mono70 => GetToolchain(RuntimeMoniker.Net70), RuntimeMoniker.Mono80 => GetToolchain(RuntimeMoniker.Net80), - _ => CsProjCoreToolchain.From(new NetCoreAppSettings(mono.MsBuildMoniker, null, mono.Name)) + _ => CsProjCoreToolchain.From(new NetCoreAppSettings(mono.MsBuildMoniker, mono.Name)) }; } else { return MonoToolchain.From( - new NetCoreAppSettings(targetFrameworkMoniker: mono.MsBuildMoniker, runtimeFrameworkVersion: null, name: mono.Name)); + new NetCoreAppSettings(targetFrameworkMoniker: mono.MsBuildMoniker, name: mono.Name)); } return RoslynToolchain.Instance; @@ -93,7 +93,7 @@ bool UseRoslyn() if (coreRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized && !coreRuntime.IsPlatformSpecific) return GetToolchain(coreRuntime.RuntimeMoniker); - return CsProjCoreToolchain.From(new NetCoreAppSettings(coreRuntime.MsBuildMoniker, null, coreRuntime.Name)); + return CsProjCoreToolchain.From(new NetCoreAppSettings(coreRuntime.MsBuildMoniker, coreRuntime.Name)); case NativeAotRuntime nativeAotRuntime: return nativeAotRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized @@ -101,13 +101,13 @@ bool UseRoslyn() : NativeAotToolchain.CreateBuilder().UseNuGet().TargetFrameworkMoniker(nativeAotRuntime.MsBuildMoniker).ToToolchain(); case WasmRuntime wasmRuntime: - return WasmToolchain.From(new NetCoreAppSettings(targetFrameworkMoniker: wasmRuntime.MsBuildMoniker, name: wasmRuntime.Name, runtimeFrameworkVersion: null)); + return WasmToolchain.From(new NetCoreAppSettings(targetFrameworkMoniker: wasmRuntime.MsBuildMoniker, name: wasmRuntime.Name)); case R2RRuntime r2rRuntime: if (r2rRuntime.RuntimeMoniker != RuntimeMoniker.NotRecognized) return GetToolchain(r2rRuntime.RuntimeMoniker); - return CsProjCoreToolchain.From(new NetCoreAppSettings(r2rRuntime.MsBuildMoniker, null, r2rRuntime.Name)); + return CsProjCoreToolchain.From(new NetCoreAppSettings(r2rRuntime.MsBuildMoniker, r2rRuntime.Name)); default: throw new ArgumentOutOfRangeException(nameof(runtime), runtime, "Runtime not supported"); From 708c386909fd370c843630a482bb5ecffdc73d0a Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:45:14 +0900 Subject: [PATCH 2/3] chore: remove source-level nullable annotations --- src/BenchmarkDotNet/Attributes/ConfigAttribute.cs | 2 -- src/BenchmarkDotNet/Attributes/Jobs/SimpleJobAttribute.cs | 2 -- src/BenchmarkDotNet/Characteristics/Characteristic.cs | 2 -- src/BenchmarkDotNet/Characteristics/CharacteristicHelper.cs | 2 -- src/BenchmarkDotNet/Characteristics/CharacteristicObject.cs | 2 -- src/BenchmarkDotNet/Characteristics/CharacteristicPresenter.cs | 2 -- .../Characteristics/CharacteristicSetPresenter.cs | 2 -- src/BenchmarkDotNet/Characteristics/Characteristic`1.cs | 2 -- src/BenchmarkDotNet/Characteristics/CompositeResolver.cs | 2 -- src/BenchmarkDotNet/Characteristics/IResolver.cs | 2 -- src/BenchmarkDotNet/Characteristics/Resolver.cs | 2 -- src/BenchmarkDotNet/Code/ArrayParam.cs | 2 -- src/BenchmarkDotNet/Code/CodeGenerator.cs | 2 -- src/BenchmarkDotNet/Code/DeclarationsProvider.cs | 2 -- src/BenchmarkDotNet/Columns/BaselineAllocationRatioColumn.cs | 2 -- src/BenchmarkDotNet/Columns/BaselineCustomColumn.cs | 2 -- src/BenchmarkDotNet/Columns/BaselineRatioColumn.cs | 2 -- src/BenchmarkDotNet/Columns/LogicalGroupColumn.cs | 2 -- src/BenchmarkDotNet/Columns/MetricColumn.cs | 2 -- src/BenchmarkDotNet/Columns/RankColumn.cs | 2 -- src/BenchmarkDotNet/Columns/StatisticColumn.cs | 2 -- src/BenchmarkDotNet/Columns/TargetMethodColumn.cs | 2 -- src/BenchmarkDotNet/Configs/DebugConfig.cs | 2 -- src/BenchmarkDotNet/Configs/DefaultConfig.cs | 2 -- src/BenchmarkDotNet/Configs/IConfig.cs | 2 -- src/BenchmarkDotNet/Configs/ImmutableConfigBuilder.cs | 2 -- src/BenchmarkDotNet/Configs/ManualConfig.cs | 2 -- src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs | 2 -- src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs | 2 -- src/BenchmarkDotNet/ConsoleArguments/ListBenchmarks/Node.cs | 2 -- src/BenchmarkDotNet/ConsoleArguments/LoggerWrapper.cs | 2 -- src/BenchmarkDotNet/Detectors/Cpu/HardwareIntrinsics.cs | 2 -- src/BenchmarkDotNet/Detectors/Cpu/Linux/LinuxCpuInfoParser.cs | 2 -- src/BenchmarkDotNet/Detectors/Cpu/Windows/MosCpuDetector.cs | 2 -- .../Detectors/Cpu/Windows/PowershellWmiCpuDetector.cs | 2 -- .../Detectors/Cpu/Windows/PowershellWmiCpuInfoParser.cs | 2 -- src/BenchmarkDotNet/Detectors/Cpu/Windows/WmicCpuInfoParser.cs | 2 -- src/BenchmarkDotNet/Detectors/Cpu/macOS/SysctlCpuInfoParser.cs | 2 -- src/BenchmarkDotNet/Detectors/OsDetector.cs | 2 -- src/BenchmarkDotNet/Diagnosers/DiagnoserActionParameters.cs | 2 -- src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs | 2 -- src/BenchmarkDotNet/Diagnosers/EventPipeProfiler.cs | 2 -- src/BenchmarkDotNet/Diagnosers/ExceptionDiagnoser.cs | 2 -- src/BenchmarkDotNet/Diagnosers/InProcessDiagnoserRouter.cs | 2 -- src/BenchmarkDotNet/Diagnosers/SnapshotProfilerBase.cs | 2 -- src/BenchmarkDotNet/Diagnosers/ThreadingDiagnoser.cs | 2 -- src/BenchmarkDotNet/Disassemblers/Arm64Disassembler.cs | 2 -- src/BenchmarkDotNet/Disassemblers/Arm64InstructionFormatter.cs | 2 -- src/BenchmarkDotNet/Disassemblers/ClrMdArgs.cs | 2 -- src/BenchmarkDotNet/Disassemblers/ClrMdDisassembler.cs | 2 -- src/BenchmarkDotNet/Disassemblers/DataContracts.cs | 2 -- src/BenchmarkDotNet/Disassemblers/DisassemblyDiagnoser.cs | 2 -- .../Disassemblers/Exporters/CombinedDisassemblyExporter.cs | 2 -- .../Disassemblers/Exporters/DisassemblyPrettifier.cs | 2 -- .../Exporters/GithubMarkdownDiffDisassemblyExporter.cs | 2 -- .../Exporters/GithubMarkdownDisassemblyExporter.cs | 2 -- .../Disassemblers/Exporters/HtmlDisassemblyExporter.cs | 2 -- src/BenchmarkDotNet/Disassemblers/Exporters/SymbolResolver.cs | 2 -- src/BenchmarkDotNet/Disassemblers/IntelDisassembler.cs | 2 -- src/BenchmarkDotNet/Disassemblers/IntelInstructionFormatter.cs | 2 -- src/BenchmarkDotNet/Disassemblers/MonoDisassembler.cs | 2 -- src/BenchmarkDotNet/Disassemblers/SourceCodeProvider.cs | 2 -- src/BenchmarkDotNet/Engines/AnonymousPipesHost.cs | 2 -- src/BenchmarkDotNet/Engines/Consumer.cs | 2 -- src/BenchmarkDotNet/Engines/Engine.cs | 2 -- src/BenchmarkDotNet/Engines/EngineFactory.cs | 2 -- src/BenchmarkDotNet/Engines/EngineJitStage.cs | 2 -- src/BenchmarkDotNet/Engines/EnginePilotStage.cs | 2 -- src/BenchmarkDotNet/Engines/GcStats.cs | 2 -- src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs | 2 -- src/BenchmarkDotNet/Environments/Runtimes/ClrRuntime.cs | 2 -- src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs | 2 -- src/BenchmarkDotNet/Environments/Runtimes/MonoAotLLVMRuntime.cs | 2 -- src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs | 2 -- src/BenchmarkDotNet/Environments/Runtimes/Runtime.cs | 2 -- src/BenchmarkDotNet/Environments/Runtimes/WasmRuntime.cs | 2 -- src/BenchmarkDotNet/Exporters/FullNameProvider.cs | 2 -- src/BenchmarkDotNet/Exporters/InstructionPointerExporter.cs | 2 -- src/BenchmarkDotNet/Exporters/Json/JsonExporterBase.cs | 2 -- src/BenchmarkDotNet/Exporters/MarkdownExporter.cs | 2 -- src/BenchmarkDotNet/Exporters/RPlotExporter.cs | 2 -- src/BenchmarkDotNet/Exporters/Xml/SummaryDto.cs | 2 -- src/BenchmarkDotNet/Exporters/Xml/XmlSerializer.cs | 2 -- src/BenchmarkDotNet/Extensions/CommonExtensions.cs | 2 -- src/BenchmarkDotNet/Extensions/PathFeatures.cs | 2 -- src/BenchmarkDotNet/Extensions/ProcessExtensions.cs | 2 -- src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs | 2 -- src/BenchmarkDotNet/Extensions/StringAndTextExtensions.cs | 2 -- src/BenchmarkDotNet/Helpers/AsciiHelper.cs | 2 -- src/BenchmarkDotNet/Helpers/AwaitHelper.cs | 2 -- src/BenchmarkDotNet/Helpers/ConsoleExitHandler.cs | 2 -- src/BenchmarkDotNet/Helpers/DirtyAssemblyResolveHelper.cs | 2 -- src/BenchmarkDotNet/Helpers/ExternalToolsHelper.cs | 2 -- src/BenchmarkDotNet/Helpers/FolderNameHelper.cs | 2 -- src/BenchmarkDotNet/Helpers/HashCode.cs | 2 -- src/BenchmarkDotNet/Helpers/LinuxOsReleaseHelper.cs | 2 -- src/BenchmarkDotNet/Helpers/PowerManagementHelper.cs | 2 -- .../Helpers/Reflection.Emit/EmitParameterInfo.cs | 2 -- .../Helpers/Reflection.Emit/IlGeneratorCallExtensions.cs | 2 -- src/BenchmarkDotNet/Helpers/ResourceHelper.cs | 2 -- src/BenchmarkDotNet/Helpers/SectionsHelper.cs | 2 -- src/BenchmarkDotNet/Helpers/SourceCodeHelper.cs | 2 -- src/BenchmarkDotNet/Jobs/Argument.cs | 2 -- src/BenchmarkDotNet/Jobs/EnvironmentMode.cs | 2 -- src/BenchmarkDotNet/Jobs/EnvironmentVariable.cs | 2 -- src/BenchmarkDotNet/Jobs/GcMode.cs | 2 -- src/BenchmarkDotNet/Jobs/InfrastructureMode.cs | 2 -- src/BenchmarkDotNet/Jobs/JobComparer.cs | 2 -- src/BenchmarkDotNet/Jobs/JobExtensions.cs | 2 -- src/BenchmarkDotNet/Jobs/JobMode`1.cs | 2 -- src/BenchmarkDotNet/Jobs/RunMode.cs | 2 -- src/BenchmarkDotNet/Loggers/AsyncProcessOutputReader.cs | 2 -- src/BenchmarkDotNet/Loggers/Broker.cs | 2 -- src/BenchmarkDotNet/Loggers/LinqPadLogger.cs | 2 -- src/BenchmarkDotNet/Loggers/LoggerExtensions.cs | 2 -- src/BenchmarkDotNet/Mathematics/Statistics.cs | 2 -- src/BenchmarkDotNet/Order/CategoryComparer.cs | 2 -- src/BenchmarkDotNet/Order/DefaultOrderer.cs | 2 -- src/BenchmarkDotNet/Parameters/ParameterComparer.cs | 2 -- src/BenchmarkDotNet/Parameters/ParameterDefinition.cs | 2 -- src/BenchmarkDotNet/Parameters/ParameterEqualityComparer.cs | 2 -- src/BenchmarkDotNet/Parameters/ParameterInstance.cs | 2 -- src/BenchmarkDotNet/Parameters/ParameterInstances.cs | 2 -- src/BenchmarkDotNet/Parameters/SmartParamBuilder.cs | 2 -- src/BenchmarkDotNet/Portability/RuntimeInformation.cs | 2 -- src/BenchmarkDotNet/Properties/BenchmarkDotNetInfo.cs | 2 -- src/BenchmarkDotNet/Reports/BenchmarkReport.cs | 2 -- src/BenchmarkDotNet/Reports/Metric.cs | 2 -- src/BenchmarkDotNet/Reports/Summary.cs | 2 -- src/BenchmarkDotNet/Reports/SummaryExtensions.cs | 2 -- src/BenchmarkDotNet/Reports/SummaryStyle.cs | 2 -- src/BenchmarkDotNet/Reports/SummaryTable.cs | 2 -- src/BenchmarkDotNet/Reports/SummaryTableExtensions.cs | 2 -- src/BenchmarkDotNet/Running/BenchmarkCase.cs | 2 -- src/BenchmarkDotNet/Running/BenchmarkConverter.cs | 2 -- src/BenchmarkDotNet/Running/BenchmarkId.cs | 2 -- src/BenchmarkDotNet/Running/BenchmarkPartitioner.cs | 2 -- src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs | 2 -- src/BenchmarkDotNet/Running/BenchmarkSwitcher.cs | 2 -- src/BenchmarkDotNet/Running/BuildPartition.cs | 2 -- src/BenchmarkDotNet/Running/ConsoleTitler.cs | 2 -- src/BenchmarkDotNet/Running/DescriptorComparer.cs | 2 -- src/BenchmarkDotNet/Running/UserInteraction.cs | 2 -- src/BenchmarkDotNet/Serialization/BdnJsonSerializer.cs | 2 -- src/BenchmarkDotNet/Toolchains/AppConfigGenerator.cs | 2 -- src/BenchmarkDotNet/Toolchains/ArtifactsPaths.cs | 2 -- src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunGenerator.cs | 2 -- src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunPublisher.cs | 2 -- src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunToolchain.cs | 2 -- .../Toolchains/CsProj/CsProjClassicNetToolchain.cs | 2 -- src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs | 2 -- .../Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs | 2 -- src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliBuilder.cs | 2 -- src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs | 2 -- .../Toolchains/DotNetCli/DotNetCliCommandExecutor.cs | 2 -- src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliGenerator.cs | 2 -- src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliPublisher.cs | 2 -- src/BenchmarkDotNet/Toolchains/DotNetCli/MsBuildErrorMapper.cs | 2 -- src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs | 2 -- src/BenchmarkDotNet/Toolchains/Executor.cs | 2 -- src/BenchmarkDotNet/Toolchains/GeneratorBase.cs | 2 -- .../InProcess/Emit/Implementation/ConsumableTypeInfo.cs | 2 -- .../InProcess/Emit/Implementation/Emitters/EmitExtensions.cs | 2 -- .../InProcess/Emit/Implementation/Emitters/RunnableEmitter.cs | 2 -- .../InProcess/Emit/Implementation/Runnable/RunnableProgram.cs | 2 -- .../Emit/Implementation/Runnable/RunnableReflectionHelpers.cs | 2 -- .../InProcess/Emit/Implementation/Runnable/RunnableReuse.cs | 2 -- .../Toolchains/InProcess/Emit/InProcessEmitBuilder.cs | 2 -- .../Toolchains/InProcess/Emit/InProcessEmitGenerator.cs | 2 -- src/BenchmarkDotNet/Toolchains/InProcess/InProcessHost.cs | 2 -- src/BenchmarkDotNet/Toolchains/InProcess/InProcessValidator.cs | 2 -- .../Toolchains/InProcess/NoEmit/BenchmarkAction.cs | 2 -- .../Toolchains/InProcess/NoEmit/BenchmarkActionFactory.cs | 2 -- .../Toolchains/InProcess/NoEmit/BenchmarkActionFactory_Base.cs | 2 -- .../InProcess/NoEmit/BenchmarkActionFactory_Implementations.cs | 2 -- .../Toolchains/InProcess/NoEmit/InProcessNoEmitExecutor.cs | 2 -- .../Toolchains/InProcess/NoEmit/InProcessNoEmitGenerator.cs | 2 -- .../Toolchains/InProcess/NoEmit/InProcessNoEmitRunner.cs | 2 -- src/BenchmarkDotNet/Toolchains/Mono/MonoAotBuilder.cs | 2 -- src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs | 2 -- .../Toolchains/MonoAotLLVM/MonoAotLLVMGenerator.cs | 2 -- src/BenchmarkDotNet/Toolchains/MonoWasm/WasmGenerator.cs | 2 -- src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs | 2 -- src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs | 2 -- .../Toolchains/NativeAot/NativeAotToolchainBuilder.cs | 2 -- src/BenchmarkDotNet/Toolchains/Parameters/ExecuteParameters.cs | 2 -- src/BenchmarkDotNet/Toolchains/R2R/R2RGenerator.cs | 2 -- src/BenchmarkDotNet/Toolchains/R2R/R2RToolchain.cs | 2 -- src/BenchmarkDotNet/Toolchains/Results/BuildResult.cs | 2 -- src/BenchmarkDotNet/Toolchains/Results/ExecuteResult.cs | 2 -- src/BenchmarkDotNet/Toolchains/Results/GenerateResult.cs | 2 -- src/BenchmarkDotNet/Toolchains/Roslyn/Builder.cs | 2 -- src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs | 2 -- src/BenchmarkDotNet/Validators/BaselineValidator.cs | 2 -- src/BenchmarkDotNet/Validators/BenchmarkProcessValidator.cs | 2 -- src/BenchmarkDotNet/Validators/CompilationValidator.cs | 2 -- src/BenchmarkDotNet/Validators/ConfigValidator.cs | 2 -- src/BenchmarkDotNet/Validators/DeferredExecutionValidator.cs | 2 -- src/BenchmarkDotNet/Validators/DotNetSdkValidator.cs | 2 -- src/BenchmarkDotNet/Validators/ExecutionValidatorBase.cs | 2 -- src/BenchmarkDotNet/Validators/ParamsAllValuesValidator.cs | 2 -- src/BenchmarkDotNet/Validators/ReturnValueValidator.cs | 2 -- src/BenchmarkDotNet/Validators/SetupCleanupValidator.cs | 2 -- src/BenchmarkDotNet/Validators/ValidationError.cs | 2 -- src/BenchmarkDotNet/Validators/ValidationParameters.cs | 2 -- 205 files changed, 410 deletions(-) diff --git a/src/BenchmarkDotNet/Attributes/ConfigAttribute.cs b/src/BenchmarkDotNet/Attributes/ConfigAttribute.cs index 082f08fcca..7389ae4882 100644 --- a/src/BenchmarkDotNet/Attributes/ConfigAttribute.cs +++ b/src/BenchmarkDotNet/Attributes/ConfigAttribute.cs @@ -1,8 +1,6 @@ using System; using BenchmarkDotNet.Configs; -#nullable enable - namespace BenchmarkDotNet.Attributes { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly)] diff --git a/src/BenchmarkDotNet/Attributes/Jobs/SimpleJobAttribute.cs b/src/BenchmarkDotNet/Attributes/Jobs/SimpleJobAttribute.cs index 39f77f259b..9230141d28 100644 --- a/src/BenchmarkDotNet/Attributes/Jobs/SimpleJobAttribute.cs +++ b/src/BenchmarkDotNet/Attributes/Jobs/SimpleJobAttribute.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Jobs; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Attributes { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)] diff --git a/src/BenchmarkDotNet/Characteristics/Characteristic.cs b/src/BenchmarkDotNet/Characteristics/Characteristic.cs index 624d3adffa..62cfb814f7 100644 --- a/src/BenchmarkDotNet/Characteristics/Characteristic.cs +++ b/src/BenchmarkDotNet/Characteristics/Characteristic.cs @@ -2,8 +2,6 @@ using System.Diagnostics.CodeAnalysis; using static BenchmarkDotNet.Characteristics.CharacteristicHelper; -#nullable enable - namespace BenchmarkDotNet.Characteristics { public abstract class Characteristic diff --git a/src/BenchmarkDotNet/Characteristics/CharacteristicHelper.cs b/src/BenchmarkDotNet/Characteristics/CharacteristicHelper.cs index d5830dd397..e2981b0f55 100644 --- a/src/BenchmarkDotNet/Characteristics/CharacteristicHelper.cs +++ b/src/BenchmarkDotNet/Characteristics/CharacteristicHelper.cs @@ -6,8 +6,6 @@ using System.Reflection; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Characteristics { public static class CharacteristicHelper diff --git a/src/BenchmarkDotNet/Characteristics/CharacteristicObject.cs b/src/BenchmarkDotNet/Characteristics/CharacteristicObject.cs index 0280d70bf2..047daff72e 100644 --- a/src/BenchmarkDotNet/Characteristics/CharacteristicObject.cs +++ b/src/BenchmarkDotNet/Characteristics/CharacteristicObject.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Extensions; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Characteristics { // TODO: better naming. diff --git a/src/BenchmarkDotNet/Characteristics/CharacteristicPresenter.cs b/src/BenchmarkDotNet/Characteristics/CharacteristicPresenter.cs index e88e21cfc1..dcb0315399 100644 --- a/src/BenchmarkDotNet/Characteristics/CharacteristicPresenter.cs +++ b/src/BenchmarkDotNet/Characteristics/CharacteristicPresenter.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Helpers; using BenchmarkDotNet.Jobs; -#nullable enable - namespace BenchmarkDotNet.Characteristics { public abstract class CharacteristicPresenter diff --git a/src/BenchmarkDotNet/Characteristics/CharacteristicSetPresenter.cs b/src/BenchmarkDotNet/Characteristics/CharacteristicSetPresenter.cs index 15b4b78dcd..d00fae05ee 100644 --- a/src/BenchmarkDotNet/Characteristics/CharacteristicSetPresenter.cs +++ b/src/BenchmarkDotNet/Characteristics/CharacteristicSetPresenter.cs @@ -7,8 +7,6 @@ using System.Collections.Generic; using System.Linq; -#nullable enable - namespace BenchmarkDotNet.Characteristics { public abstract class CharacteristicSetPresenter diff --git a/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs b/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs index 0b74692d45..212fa324b1 100644 --- a/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs +++ b/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs @@ -1,8 +1,6 @@ using System; using System.Diagnostics.CodeAnalysis; -#nullable enable - namespace BenchmarkDotNet.Characteristics { public class Characteristic<[DynamicallyAccessedMembers(CharacteristicObject.CharacteristicMemberTypes)] T> : Characteristic diff --git a/src/BenchmarkDotNet/Characteristics/CompositeResolver.cs b/src/BenchmarkDotNet/Characteristics/CompositeResolver.cs index d61602edb7..4ef910084d 100644 --- a/src/BenchmarkDotNet/Characteristics/CompositeResolver.cs +++ b/src/BenchmarkDotNet/Characteristics/CompositeResolver.cs @@ -2,8 +2,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; -#nullable enable - namespace BenchmarkDotNet.Characteristics { public class CompositeResolver : IResolver diff --git a/src/BenchmarkDotNet/Characteristics/IResolver.cs b/src/BenchmarkDotNet/Characteristics/IResolver.cs index b4c6afb548..9007ac21a8 100644 --- a/src/BenchmarkDotNet/Characteristics/IResolver.cs +++ b/src/BenchmarkDotNet/Characteristics/IResolver.cs @@ -1,7 +1,5 @@ using System.Diagnostics.CodeAnalysis; -#nullable enable - namespace BenchmarkDotNet.Characteristics { /// diff --git a/src/BenchmarkDotNet/Characteristics/Resolver.cs b/src/BenchmarkDotNet/Characteristics/Resolver.cs index 8580e48b66..be8cd57da4 100644 --- a/src/BenchmarkDotNet/Characteristics/Resolver.cs +++ b/src/BenchmarkDotNet/Characteristics/Resolver.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -#nullable enable - namespace BenchmarkDotNet.Characteristics { public class Resolver : IResolver diff --git a/src/BenchmarkDotNet/Code/ArrayParam.cs b/src/BenchmarkDotNet/Code/ArrayParam.cs index 4613c9c876..41028e1167 100644 --- a/src/BenchmarkDotNet/Code/ArrayParam.cs +++ b/src/BenchmarkDotNet/Code/ArrayParam.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Helpers; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Code { internal static class ArrayParam diff --git a/src/BenchmarkDotNet/Code/CodeGenerator.cs b/src/BenchmarkDotNet/Code/CodeGenerator.cs index 3db3d92797..fa0f4c4567 100644 --- a/src/BenchmarkDotNet/Code/CodeGenerator.cs +++ b/src/BenchmarkDotNet/Code/CodeGenerator.cs @@ -17,8 +17,6 @@ using BenchmarkDotNet.Running; using RunMode = BenchmarkDotNet.Jobs.RunMode; -#nullable enable - namespace BenchmarkDotNet.Code { internal static class CodeGenerator diff --git a/src/BenchmarkDotNet/Code/DeclarationsProvider.cs b/src/BenchmarkDotNet/Code/DeclarationsProvider.cs index a38be18ce3..7bb3dedd1c 100644 --- a/src/BenchmarkDotNet/Code/DeclarationsProvider.cs +++ b/src/BenchmarkDotNet/Code/DeclarationsProvider.cs @@ -3,8 +3,6 @@ using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Code { internal abstract class DeclarationsProvider diff --git a/src/BenchmarkDotNet/Columns/BaselineAllocationRatioColumn.cs b/src/BenchmarkDotNet/Columns/BaselineAllocationRatioColumn.cs index ab2f292579..4fb4b654fa 100644 --- a/src/BenchmarkDotNet/Columns/BaselineAllocationRatioColumn.cs +++ b/src/BenchmarkDotNet/Columns/BaselineAllocationRatioColumn.cs @@ -7,8 +7,6 @@ using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Columns { public class BaselineAllocationRatioColumn : BaselineCustomColumn diff --git a/src/BenchmarkDotNet/Columns/BaselineCustomColumn.cs b/src/BenchmarkDotNet/Columns/BaselineCustomColumn.cs index f5354b14f0..01b38ef7b2 100644 --- a/src/BenchmarkDotNet/Columns/BaselineCustomColumn.cs +++ b/src/BenchmarkDotNet/Columns/BaselineCustomColumn.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Running; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Columns { public abstract class BaselineCustomColumn : IColumn diff --git a/src/BenchmarkDotNet/Columns/BaselineRatioColumn.cs b/src/BenchmarkDotNet/Columns/BaselineRatioColumn.cs index 5f5fcac887..653793650c 100644 --- a/src/BenchmarkDotNet/Columns/BaselineRatioColumn.cs +++ b/src/BenchmarkDotNet/Columns/BaselineRatioColumn.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Columns { public class BaselineRatioColumn : BaselineCustomColumn diff --git a/src/BenchmarkDotNet/Columns/LogicalGroupColumn.cs b/src/BenchmarkDotNet/Columns/LogicalGroupColumn.cs index 52bb15f2fc..308a6e8172 100644 --- a/src/BenchmarkDotNet/Columns/LogicalGroupColumn.cs +++ b/src/BenchmarkDotNet/Columns/LogicalGroupColumn.cs @@ -2,8 +2,6 @@ using BenchmarkDotNet.Running; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Columns { public class LogicalGroupColumn : IColumn diff --git a/src/BenchmarkDotNet/Columns/MetricColumn.cs b/src/BenchmarkDotNet/Columns/MetricColumn.cs index 613704264e..15b8417459 100644 --- a/src/BenchmarkDotNet/Columns/MetricColumn.cs +++ b/src/BenchmarkDotNet/Columns/MetricColumn.cs @@ -6,8 +6,6 @@ using Perfolizer.Metrology; using Pragmastat.Metrology; -#nullable enable - namespace BenchmarkDotNet.Columns { public class MetricColumn : IColumn diff --git a/src/BenchmarkDotNet/Columns/RankColumn.cs b/src/BenchmarkDotNet/Columns/RankColumn.cs index eab9fe66de..8d331bcdd0 100644 --- a/src/BenchmarkDotNet/Columns/RankColumn.cs +++ b/src/BenchmarkDotNet/Columns/RankColumn.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Running; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Columns { public class RankColumn : IColumn diff --git a/src/BenchmarkDotNet/Columns/StatisticColumn.cs b/src/BenchmarkDotNet/Columns/StatisticColumn.cs index 9b1e486e9f..c72d82d4bf 100644 --- a/src/BenchmarkDotNet/Columns/StatisticColumn.cs +++ b/src/BenchmarkDotNet/Columns/StatisticColumn.cs @@ -12,8 +12,6 @@ using Perfolizer.Metrology; using Pragmastat.Metrology; -#nullable enable - namespace BenchmarkDotNet.Columns { public interface IStatisticColumn : IColumn diff --git a/src/BenchmarkDotNet/Columns/TargetMethodColumn.cs b/src/BenchmarkDotNet/Columns/TargetMethodColumn.cs index a9d5fd5a06..21673f265f 100644 --- a/src/BenchmarkDotNet/Columns/TargetMethodColumn.cs +++ b/src/BenchmarkDotNet/Columns/TargetMethodColumn.cs @@ -3,8 +3,6 @@ using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Columns { public class TargetMethodColumn : IColumn diff --git a/src/BenchmarkDotNet/Configs/DebugConfig.cs b/src/BenchmarkDotNet/Configs/DebugConfig.cs index 82ae86c4f0..ba903298fb 100644 --- a/src/BenchmarkDotNet/Configs/DebugConfig.cs +++ b/src/BenchmarkDotNet/Configs/DebugConfig.cs @@ -17,8 +17,6 @@ using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Configs { /// diff --git a/src/BenchmarkDotNet/Configs/DefaultConfig.cs b/src/BenchmarkDotNet/Configs/DefaultConfig.cs index abd286f30c..af91249acd 100644 --- a/src/BenchmarkDotNet/Configs/DefaultConfig.cs +++ b/src/BenchmarkDotNet/Configs/DefaultConfig.cs @@ -19,8 +19,6 @@ using BenchmarkDotNet.Running; using BenchmarkDotNet.Validators; -#nullable enable - namespace BenchmarkDotNet.Configs { public class DefaultConfig : IConfig diff --git a/src/BenchmarkDotNet/Configs/IConfig.cs b/src/BenchmarkDotNet/Configs/IConfig.cs index 5098e08d5c..56f019fd54 100644 --- a/src/BenchmarkDotNet/Configs/IConfig.cs +++ b/src/BenchmarkDotNet/Configs/IConfig.cs @@ -14,8 +14,6 @@ using BenchmarkDotNet.Running; using BenchmarkDotNet.Validators; -#nullable enable - namespace BenchmarkDotNet.Configs { public interface IConfig diff --git a/src/BenchmarkDotNet/Configs/ImmutableConfigBuilder.cs b/src/BenchmarkDotNet/Configs/ImmutableConfigBuilder.cs index ea49ec9ad6..334847d8fb 100644 --- a/src/BenchmarkDotNet/Configs/ImmutableConfigBuilder.cs +++ b/src/BenchmarkDotNet/Configs/ImmutableConfigBuilder.cs @@ -11,8 +11,6 @@ using System.Collections.Immutable; using System.Linq; -#nullable enable - namespace BenchmarkDotNet.Configs { /// diff --git a/src/BenchmarkDotNet/Configs/ManualConfig.cs b/src/BenchmarkDotNet/Configs/ManualConfig.cs index c50140ed7b..a8a21e44bb 100644 --- a/src/BenchmarkDotNet/Configs/ManualConfig.cs +++ b/src/BenchmarkDotNet/Configs/ManualConfig.cs @@ -19,8 +19,6 @@ using BenchmarkDotNet.Validators; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Configs { public class ManualConfig : IConfig diff --git a/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs b/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs index 5a965aefbf..259b2c7bdc 100644 --- a/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs +++ b/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs @@ -14,8 +14,6 @@ using JetBrains.Annotations; using Perfolizer.Mathematics.OutlierDetection; -#nullable enable - namespace BenchmarkDotNet.ConsoleArguments { [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] diff --git a/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs b/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs index 2c5a095b96..2992a09cae 100644 --- a/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs +++ b/src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs @@ -31,8 +31,6 @@ using BenchmarkDotNet.Toolchains.Mono; using Perfolizer.Metrology; -#nullable enable - namespace BenchmarkDotNet.ConsoleArguments { public static class ConfigParser diff --git a/src/BenchmarkDotNet/ConsoleArguments/ListBenchmarks/Node.cs b/src/BenchmarkDotNet/ConsoleArguments/ListBenchmarks/Node.cs index 9994329554..126a9843ef 100644 --- a/src/BenchmarkDotNet/ConsoleArguments/ListBenchmarks/Node.cs +++ b/src/BenchmarkDotNet/ConsoleArguments/ListBenchmarks/Node.cs @@ -1,7 +1,5 @@ using System.Collections.Generic; -#nullable enable - namespace BenchmarkDotNet.ConsoleArguments.ListBenchmarks { internal class Node diff --git a/src/BenchmarkDotNet/ConsoleArguments/LoggerWrapper.cs b/src/BenchmarkDotNet/ConsoleArguments/LoggerWrapper.cs index 9902470b74..bd878c9c02 100644 --- a/src/BenchmarkDotNet/ConsoleArguments/LoggerWrapper.cs +++ b/src/BenchmarkDotNet/ConsoleArguments/LoggerWrapper.cs @@ -2,8 +2,6 @@ using System.Text; using BenchmarkDotNet.Loggers; -#nullable enable - namespace BenchmarkDotNet.ConsoleArguments { internal class LoggerWrapper : TextWriter diff --git a/src/BenchmarkDotNet/Detectors/Cpu/HardwareIntrinsics.cs b/src/BenchmarkDotNet/Detectors/Cpu/HardwareIntrinsics.cs index 58fe4d6495..683e703ea6 100644 --- a/src/BenchmarkDotNet/Detectors/Cpu/HardwareIntrinsics.cs +++ b/src/BenchmarkDotNet/Detectors/Cpu/HardwareIntrinsics.cs @@ -9,8 +9,6 @@ using System.Runtime.Intrinsics.Arm; #endif -#nullable enable - namespace BenchmarkDotNet.Detectors.Cpu { // based on https://github.com/dotnet/runtime/tree/v10.0.0-rc.1.25451.107/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt diff --git a/src/BenchmarkDotNet/Detectors/Cpu/Linux/LinuxCpuInfoParser.cs b/src/BenchmarkDotNet/Detectors/Cpu/Linux/LinuxCpuInfoParser.cs index b01704271d..abaecc17eb 100644 --- a/src/BenchmarkDotNet/Detectors/Cpu/Linux/LinuxCpuInfoParser.cs +++ b/src/BenchmarkDotNet/Detectors/Cpu/Linux/LinuxCpuInfoParser.cs @@ -10,8 +10,6 @@ namespace BenchmarkDotNet.Detectors.Cpu.Linux; -#nullable enable - internal static class LinuxCpuInfoParser { private static class ProcCpu diff --git a/src/BenchmarkDotNet/Detectors/Cpu/Windows/MosCpuDetector.cs b/src/BenchmarkDotNet/Detectors/Cpu/Windows/MosCpuDetector.cs index 75e76a3aff..d352ae9590 100644 --- a/src/BenchmarkDotNet/Detectors/Cpu/Windows/MosCpuDetector.cs +++ b/src/BenchmarkDotNet/Detectors/Cpu/Windows/MosCpuDetector.cs @@ -8,8 +8,6 @@ using Perfolizer.Horology; using Perfolizer.Models; -#nullable enable - namespace BenchmarkDotNet.Detectors.Cpu.Windows; internal class MosCpuDetector : ICpuDetector diff --git a/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuDetector.cs b/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuDetector.cs index 5e256d42a1..724ff93a0d 100644 --- a/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuDetector.cs +++ b/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuDetector.cs @@ -8,8 +8,6 @@ using BenchmarkDotNet.Helpers; using Perfolizer.Models; -#nullable enable - namespace BenchmarkDotNet.Detectors.Cpu.Windows; /// diff --git a/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuInfoParser.cs b/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuInfoParser.cs index 54329c3e2f..a789bc9a9e 100644 --- a/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuInfoParser.cs +++ b/src/BenchmarkDotNet/Detectors/Cpu/Windows/PowershellWmiCpuInfoParser.cs @@ -7,8 +7,6 @@ namespace BenchmarkDotNet.Detectors.Cpu.Windows; -#nullable enable - internal static class PowershellWmiCpuInfoParser { internal static CpuInfo Parse(string powershellWmiOutput) diff --git a/src/BenchmarkDotNet/Detectors/Cpu/Windows/WmicCpuInfoParser.cs b/src/BenchmarkDotNet/Detectors/Cpu/Windows/WmicCpuInfoParser.cs index 73dd23c9b7..c4f25505a2 100644 --- a/src/BenchmarkDotNet/Detectors/Cpu/Windows/WmicCpuInfoParser.cs +++ b/src/BenchmarkDotNet/Detectors/Cpu/Windows/WmicCpuInfoParser.cs @@ -7,8 +7,6 @@ namespace BenchmarkDotNet.Detectors.Cpu.Windows; -#nullable enable - internal static class WmicCpuInfoParser { /// diff --git a/src/BenchmarkDotNet/Detectors/Cpu/macOS/SysctlCpuInfoParser.cs b/src/BenchmarkDotNet/Detectors/Cpu/macOS/SysctlCpuInfoParser.cs index 461bad24e5..dc9a394146 100644 --- a/src/BenchmarkDotNet/Detectors/Cpu/macOS/SysctlCpuInfoParser.cs +++ b/src/BenchmarkDotNet/Detectors/Cpu/macOS/SysctlCpuInfoParser.cs @@ -6,8 +6,6 @@ namespace BenchmarkDotNet.Detectors.Cpu.macOS; -#nullable enable - internal static class SysctlCpuInfoParser { private static class Sysctl diff --git a/src/BenchmarkDotNet/Detectors/OsDetector.cs b/src/BenchmarkDotNet/Detectors/OsDetector.cs index e9748ea4ec..728e7dff49 100644 --- a/src/BenchmarkDotNet/Detectors/OsDetector.cs +++ b/src/BenchmarkDotNet/Detectors/OsDetector.cs @@ -10,8 +10,6 @@ using RuntimeEnvironment = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment; using System.Runtime.Versioning; -#nullable enable - namespace BenchmarkDotNet.Detectors; public class OsDetector diff --git a/src/BenchmarkDotNet/Diagnosers/DiagnoserActionParameters.cs b/src/BenchmarkDotNet/Diagnosers/DiagnoserActionParameters.cs index 229aa6ab91..07c8cb7ec8 100644 --- a/src/BenchmarkDotNet/Diagnosers/DiagnoserActionParameters.cs +++ b/src/BenchmarkDotNet/Diagnosers/DiagnoserActionParameters.cs @@ -3,8 +3,6 @@ using BenchmarkDotNet.Configs; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Diagnosers { public class DiagnoserActionParameters diff --git a/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs b/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs index d5b73c3320..d214c123ce 100644 --- a/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs +++ b/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs @@ -9,8 +9,6 @@ using BenchmarkDotNet.Loggers; using BenchmarkDotNet.Portability; -#nullable enable - namespace BenchmarkDotNet.Diagnosers { internal static class DiagnosersLoader diff --git a/src/BenchmarkDotNet/Diagnosers/EventPipeProfiler.cs b/src/BenchmarkDotNet/Diagnosers/EventPipeProfiler.cs index e32af9c61d..cad872292a 100644 --- a/src/BenchmarkDotNet/Diagnosers/EventPipeProfiler.cs +++ b/src/BenchmarkDotNet/Diagnosers/EventPipeProfiler.cs @@ -18,8 +18,6 @@ using BenchmarkDotNet.Validators; using Microsoft.Diagnostics.NETCore.Client; -#nullable enable - namespace BenchmarkDotNet.Diagnosers { public class EventPipeProfiler : IProfiler diff --git a/src/BenchmarkDotNet/Diagnosers/ExceptionDiagnoser.cs b/src/BenchmarkDotNet/Diagnosers/ExceptionDiagnoser.cs index 3818305e20..589584899d 100644 --- a/src/BenchmarkDotNet/Diagnosers/ExceptionDiagnoser.cs +++ b/src/BenchmarkDotNet/Diagnosers/ExceptionDiagnoser.cs @@ -17,8 +17,6 @@ using System.Runtime.ExceptionServices; using System.Threading; -#nullable enable - namespace BenchmarkDotNet.Diagnosers { public class ExceptionDiagnoser(ExceptionDiagnoserConfig config) : IInProcessDiagnoser diff --git a/src/BenchmarkDotNet/Diagnosers/InProcessDiagnoserRouter.cs b/src/BenchmarkDotNet/Diagnosers/InProcessDiagnoserRouter.cs index d02956c191..e25c67ae60 100644 --- a/src/BenchmarkDotNet/Diagnosers/InProcessDiagnoserRouter.cs +++ b/src/BenchmarkDotNet/Diagnosers/InProcessDiagnoserRouter.cs @@ -5,8 +5,6 @@ using System.ComponentModel; using System.Runtime.CompilerServices; -#nullable enable - namespace BenchmarkDotNet.Diagnosers; [UsedImplicitly] diff --git a/src/BenchmarkDotNet/Diagnosers/SnapshotProfilerBase.cs b/src/BenchmarkDotNet/Diagnosers/SnapshotProfilerBase.cs index 456bccf449..d6eb1db611 100644 --- a/src/BenchmarkDotNet/Diagnosers/SnapshotProfilerBase.cs +++ b/src/BenchmarkDotNet/Diagnosers/SnapshotProfilerBase.cs @@ -14,8 +14,6 @@ using System.Linq; using System.Threading; -#nullable enable - namespace BenchmarkDotNet.Diagnosers; public abstract class SnapshotProfilerBase : IProfiler diff --git a/src/BenchmarkDotNet/Diagnosers/ThreadingDiagnoser.cs b/src/BenchmarkDotNet/Diagnosers/ThreadingDiagnoser.cs index fd1d87e3f9..4b2cb75f73 100644 --- a/src/BenchmarkDotNet/Diagnosers/ThreadingDiagnoser.cs +++ b/src/BenchmarkDotNet/Diagnosers/ThreadingDiagnoser.cs @@ -17,8 +17,6 @@ using BenchmarkDotNet.Validators; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Diagnosers { public class ThreadingDiagnoser(ThreadingDiagnoserConfig config) : IInProcessDiagnoser diff --git a/src/BenchmarkDotNet/Disassemblers/Arm64Disassembler.cs b/src/BenchmarkDotNet/Disassemblers/Arm64Disassembler.cs index be90a63a12..3c099d6a82 100644 --- a/src/BenchmarkDotNet/Disassemblers/Arm64Disassembler.cs +++ b/src/BenchmarkDotNet/Disassemblers/Arm64Disassembler.cs @@ -6,8 +6,6 @@ using System.Collections.Generic; using System.Linq; -#nullable enable - namespace BenchmarkDotNet.Disassemblers { internal struct RegisterValueAccumulator diff --git a/src/BenchmarkDotNet/Disassemblers/Arm64InstructionFormatter.cs b/src/BenchmarkDotNet/Disassemblers/Arm64InstructionFormatter.cs index db27fd0a67..c59f22f1a5 100644 --- a/src/BenchmarkDotNet/Disassemblers/Arm64InstructionFormatter.cs +++ b/src/BenchmarkDotNet/Disassemblers/Arm64InstructionFormatter.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.Text; -#nullable enable - namespace BenchmarkDotNet.Disassemblers { internal static class Arm64InstructionFormatter diff --git a/src/BenchmarkDotNet/Disassemblers/ClrMdArgs.cs b/src/BenchmarkDotNet/Disassemblers/ClrMdArgs.cs index 8abbf910d7..67703ca9ff 100644 --- a/src/BenchmarkDotNet/Disassemblers/ClrMdArgs.cs +++ b/src/BenchmarkDotNet/Disassemblers/ClrMdArgs.cs @@ -2,8 +2,6 @@ using System.Linq; using System.Text.Json.Serialization; -#nullable enable - namespace BenchmarkDotNet.Disassemblers { internal struct ClrMdArgs(int processId, string typeName, string methodName, bool printSource, int maxDepth, string syntax, string tfm, string[] filters, string resultsPath = "") diff --git a/src/BenchmarkDotNet/Disassemblers/ClrMdDisassembler.cs b/src/BenchmarkDotNet/Disassemblers/ClrMdDisassembler.cs index a1b51f9e2b..0d9ceae175 100644 --- a/src/BenchmarkDotNet/Disassemblers/ClrMdDisassembler.cs +++ b/src/BenchmarkDotNet/Disassemblers/ClrMdDisassembler.cs @@ -11,8 +11,6 @@ using Microsoft.Diagnostics.NETCore.Client; using BenchmarkDotNet.Extensions; -#nullable enable - namespace BenchmarkDotNet.Disassemblers { internal abstract class ClrMdDisassembler diff --git a/src/BenchmarkDotNet/Disassemblers/DataContracts.cs b/src/BenchmarkDotNet/Disassemblers/DataContracts.cs index 22b081650e..72abc35499 100644 --- a/src/BenchmarkDotNet/Disassemblers/DataContracts.cs +++ b/src/BenchmarkDotNet/Disassemblers/DataContracts.cs @@ -15,8 +15,6 @@ using System.Diagnostics.CodeAnalysis; #endif -#nullable enable - namespace BenchmarkDotNet.Disassemblers; [JsonPolymorphic(TypeDiscriminatorPropertyName = "$type")] diff --git a/src/BenchmarkDotNet/Disassemblers/DisassemblyDiagnoser.cs b/src/BenchmarkDotNet/Disassemblers/DisassemblyDiagnoser.cs index d35925f0d6..fa75e9f170 100644 --- a/src/BenchmarkDotNet/Disassemblers/DisassemblyDiagnoser.cs +++ b/src/BenchmarkDotNet/Disassemblers/DisassemblyDiagnoser.cs @@ -24,8 +24,6 @@ using System.Diagnostics; using System.Linq; -#nullable enable - namespace BenchmarkDotNet.Diagnosers { public class DisassemblyDiagnoser : IInProcessDiagnoser diff --git a/src/BenchmarkDotNet/Disassemblers/Exporters/CombinedDisassemblyExporter.cs b/src/BenchmarkDotNet/Disassemblers/Exporters/CombinedDisassemblyExporter.cs index 0f68c0c930..4cb9ca3add 100644 --- a/src/BenchmarkDotNet/Disassemblers/Exporters/CombinedDisassemblyExporter.cs +++ b/src/BenchmarkDotNet/Disassemblers/Exporters/CombinedDisassemblyExporter.cs @@ -8,8 +8,6 @@ using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Disassemblers.Exporters { internal class CombinedDisassemblyExporter : ExporterBase diff --git a/src/BenchmarkDotNet/Disassemblers/Exporters/DisassemblyPrettifier.cs b/src/BenchmarkDotNet/Disassemblers/Exporters/DisassemblyPrettifier.cs index fc51df450b..5ef646b44a 100644 --- a/src/BenchmarkDotNet/Disassemblers/Exporters/DisassemblyPrettifier.cs +++ b/src/BenchmarkDotNet/Disassemblers/Exporters/DisassemblyPrettifier.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Linq; -#nullable enable - namespace BenchmarkDotNet.Disassemblers.Exporters { internal static class DisassemblyPrettifier diff --git a/src/BenchmarkDotNet/Disassemblers/Exporters/GithubMarkdownDiffDisassemblyExporter.cs b/src/BenchmarkDotNet/Disassemblers/Exporters/GithubMarkdownDiffDisassemblyExporter.cs index 1063b734a6..563b48ba21 100644 --- a/src/BenchmarkDotNet/Disassemblers/Exporters/GithubMarkdownDiffDisassemblyExporter.cs +++ b/src/BenchmarkDotNet/Disassemblers/Exporters/GithubMarkdownDiffDisassemblyExporter.cs @@ -10,8 +10,6 @@ using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Disassemblers.Exporters { internal class GithubMarkdownDiffDisassemblyExporter : ExporterBase diff --git a/src/BenchmarkDotNet/Disassemblers/Exporters/GithubMarkdownDisassemblyExporter.cs b/src/BenchmarkDotNet/Disassemblers/Exporters/GithubMarkdownDisassemblyExporter.cs index cf161e034d..b7fdbb6d92 100644 --- a/src/BenchmarkDotNet/Disassemblers/Exporters/GithubMarkdownDisassemblyExporter.cs +++ b/src/BenchmarkDotNet/Disassemblers/Exporters/GithubMarkdownDisassemblyExporter.cs @@ -7,8 +7,6 @@ using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Disassemblers.Exporters { internal class GithubMarkdownDisassemblyExporter : ExporterBase diff --git a/src/BenchmarkDotNet/Disassemblers/Exporters/HtmlDisassemblyExporter.cs b/src/BenchmarkDotNet/Disassemblers/Exporters/HtmlDisassemblyExporter.cs index 88cfd1557b..341d84bc1a 100644 --- a/src/BenchmarkDotNet/Disassemblers/Exporters/HtmlDisassemblyExporter.cs +++ b/src/BenchmarkDotNet/Disassemblers/Exporters/HtmlDisassemblyExporter.cs @@ -9,8 +9,6 @@ using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Disassemblers.Exporters { internal class HtmlDisassemblyExporter : ExporterBase diff --git a/src/BenchmarkDotNet/Disassemblers/Exporters/SymbolResolver.cs b/src/BenchmarkDotNet/Disassemblers/Exporters/SymbolResolver.cs index 521f8ebc3d..360ca4438c 100644 --- a/src/BenchmarkDotNet/Disassemblers/Exporters/SymbolResolver.cs +++ b/src/BenchmarkDotNet/Disassemblers/Exporters/SymbolResolver.cs @@ -1,8 +1,6 @@ using Iced.Intel; using System.Collections.Generic; -#nullable enable - namespace BenchmarkDotNet.Disassemblers.Exporters { internal sealed class SymbolResolver : ISymbolResolver diff --git a/src/BenchmarkDotNet/Disassemblers/IntelDisassembler.cs b/src/BenchmarkDotNet/Disassemblers/IntelDisassembler.cs index a5cc864fca..c01eca932d 100644 --- a/src/BenchmarkDotNet/Disassemblers/IntelDisassembler.cs +++ b/src/BenchmarkDotNet/Disassemblers/IntelDisassembler.cs @@ -5,8 +5,6 @@ using System.Collections.Generic; using System.Linq; -#nullable enable - namespace BenchmarkDotNet.Disassemblers { internal class IntelDisassembler : ClrMdDisassembler diff --git a/src/BenchmarkDotNet/Disassemblers/IntelInstructionFormatter.cs b/src/BenchmarkDotNet/Disassemblers/IntelInstructionFormatter.cs index ce1da1ad7e..b2b0269080 100644 --- a/src/BenchmarkDotNet/Disassemblers/IntelInstructionFormatter.cs +++ b/src/BenchmarkDotNet/Disassemblers/IntelInstructionFormatter.cs @@ -1,7 +1,5 @@ using Iced.Intel; -#nullable enable - namespace BenchmarkDotNet.Disassemblers { internal static class IntelInstructionFormatter diff --git a/src/BenchmarkDotNet/Disassemblers/MonoDisassembler.cs b/src/BenchmarkDotNet/Disassemblers/MonoDisassembler.cs index d222257f55..66f7af6abe 100644 --- a/src/BenchmarkDotNet/Disassemblers/MonoDisassembler.cs +++ b/src/BenchmarkDotNet/Disassemblers/MonoDisassembler.cs @@ -12,8 +12,6 @@ using BenchmarkDotNet.Portability; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Disassemblers { internal sealed class MonoDisassembler diff --git a/src/BenchmarkDotNet/Disassemblers/SourceCodeProvider.cs b/src/BenchmarkDotNet/Disassemblers/SourceCodeProvider.cs index 5468650a1b..82382e6953 100644 --- a/src/BenchmarkDotNet/Disassemblers/SourceCodeProvider.cs +++ b/src/BenchmarkDotNet/Disassemblers/SourceCodeProvider.cs @@ -6,8 +6,6 @@ using System.Diagnostics; using System.IO; -#nullable enable - namespace BenchmarkDotNet.Disassemblers { internal class SourceCodeProvider : IDisposable diff --git a/src/BenchmarkDotNet/Engines/AnonymousPipesHost.cs b/src/BenchmarkDotNet/Engines/AnonymousPipesHost.cs index d7503707c4..7707d2d1cf 100644 --- a/src/BenchmarkDotNet/Engines/AnonymousPipesHost.cs +++ b/src/BenchmarkDotNet/Engines/AnonymousPipesHost.cs @@ -7,8 +7,6 @@ using BenchmarkDotNet.Portability; using System.Runtime.CompilerServices; -#nullable enable - namespace BenchmarkDotNet.Engines { public class AnonymousPipesHost : IHost diff --git a/src/BenchmarkDotNet/Engines/Consumer.cs b/src/BenchmarkDotNet/Engines/Consumer.cs index 6848f54089..085dee6b86 100644 --- a/src/BenchmarkDotNet/Engines/Consumer.cs +++ b/src/BenchmarkDotNet/Engines/Consumer.cs @@ -3,8 +3,6 @@ using System.Threading; using JetBrains.Annotations; -#nullable enable - // ReSharper disable NotAccessedField.Local namespace BenchmarkDotNet.Engines { diff --git a/src/BenchmarkDotNet/Engines/Engine.cs b/src/BenchmarkDotNet/Engines/Engine.cs index 2fea05fdfc..334fe40b90 100644 --- a/src/BenchmarkDotNet/Engines/Engine.cs +++ b/src/BenchmarkDotNet/Engines/Engine.cs @@ -10,8 +10,6 @@ using JetBrains.Annotations; using Perfolizer.Horology; -#nullable enable - namespace BenchmarkDotNet.Engines { [UsedImplicitly] diff --git a/src/BenchmarkDotNet/Engines/EngineFactory.cs b/src/BenchmarkDotNet/Engines/EngineFactory.cs index ebb142b8ad..8169c7a175 100644 --- a/src/BenchmarkDotNet/Engines/EngineFactory.cs +++ b/src/BenchmarkDotNet/Engines/EngineFactory.cs @@ -1,7 +1,5 @@ namespace BenchmarkDotNet.Engines; -#nullable enable - public class EngineFactory : IEngineFactory { public IEngine Create(EngineParameters engineParameters) diff --git a/src/BenchmarkDotNet/Engines/EngineJitStage.cs b/src/BenchmarkDotNet/Engines/EngineJitStage.cs index 93d33f9ca2..a774696417 100644 --- a/src/BenchmarkDotNet/Engines/EngineJitStage.cs +++ b/src/BenchmarkDotNet/Engines/EngineJitStage.cs @@ -7,8 +7,6 @@ namespace BenchmarkDotNet.Engines; -#nullable enable - internal abstract class EngineJitStage(EngineParameters parameters) : EngineStage(IterationStage.Jitting, IterationMode.Workload, parameters) { } diff --git a/src/BenchmarkDotNet/Engines/EnginePilotStage.cs b/src/BenchmarkDotNet/Engines/EnginePilotStage.cs index 88f7a8f7c7..041978e667 100644 --- a/src/BenchmarkDotNet/Engines/EnginePilotStage.cs +++ b/src/BenchmarkDotNet/Engines/EnginePilotStage.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Reports; using Perfolizer.Horology; -#nullable enable - namespace BenchmarkDotNet.Engines { // TODO: use clockResolution diff --git a/src/BenchmarkDotNet/Engines/GcStats.cs b/src/BenchmarkDotNet/Engines/GcStats.cs index 2c12864570..b992c25688 100644 --- a/src/BenchmarkDotNet/Engines/GcStats.cs +++ b/src/BenchmarkDotNet/Engines/GcStats.cs @@ -7,8 +7,6 @@ using BenchmarkDotNet.Running; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Engines { public struct GcStats : IEquatable diff --git a/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs b/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs index 1e756918b9..cfb31e0841 100644 --- a/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs +++ b/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs @@ -17,8 +17,6 @@ using Perfolizer.Metrology; using BenchmarkDotNet.Extensions; -#nullable enable - namespace BenchmarkDotNet.Environments { // this class is used by our auto-generated benchmark program, diff --git a/src/BenchmarkDotNet/Environments/Runtimes/ClrRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/ClrRuntime.cs index bfa37a8b60..51a649a191 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/ClrRuntime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/ClrRuntime.cs @@ -4,8 +4,6 @@ using BenchmarkDotNet.Helpers; using BenchmarkDotNet.Jobs; -#nullable enable - namespace BenchmarkDotNet.Environments { public class ClrRuntime : Runtime, IEquatable diff --git a/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs index 92f379d4c3..671c88b635 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/CoreRuntime.cs @@ -10,8 +10,6 @@ using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Portability; -#nullable enable - namespace BenchmarkDotNet.Environments { public class CoreRuntime : Runtime diff --git a/src/BenchmarkDotNet/Environments/Runtimes/MonoAotLLVMRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/MonoAotLLVMRuntime.cs index f96cd45c0e..b0441e30f5 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/MonoAotLLVMRuntime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/MonoAotLLVMRuntime.cs @@ -6,8 +6,6 @@ using System.ComponentModel; using System.IO; -#nullable enable - namespace BenchmarkDotNet.Environments { public class MonoAotLLVMRuntime : Runtime, IEquatable diff --git a/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs index ab9c218dbd..429d0c4682 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/MonoRuntime.cs @@ -1,8 +1,6 @@ using System; using BenchmarkDotNet.Jobs; -#nullable enable - namespace BenchmarkDotNet.Environments { public class MonoRuntime : Runtime, IEquatable diff --git a/src/BenchmarkDotNet/Environments/Runtimes/Runtime.cs b/src/BenchmarkDotNet/Environments/Runtimes/Runtime.cs index 6636a06f11..0a952a4fe1 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/Runtime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/Runtime.cs @@ -2,8 +2,6 @@ using BenchmarkDotNet.Jobs; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Environments { public abstract class Runtime : IEquatable diff --git a/src/BenchmarkDotNet/Environments/Runtimes/WasmRuntime.cs b/src/BenchmarkDotNet/Environments/Runtimes/WasmRuntime.cs index be51bebff6..7e7fb6ec6b 100644 --- a/src/BenchmarkDotNet/Environments/Runtimes/WasmRuntime.cs +++ b/src/BenchmarkDotNet/Environments/Runtimes/WasmRuntime.cs @@ -4,8 +4,6 @@ using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Jobs; -#nullable enable - namespace BenchmarkDotNet.Environments { public class WasmRuntime : Runtime, IEquatable diff --git a/src/BenchmarkDotNet/Exporters/FullNameProvider.cs b/src/BenchmarkDotNet/Exporters/FullNameProvider.cs index 4e68d0745b..c4a18ab264 100644 --- a/src/BenchmarkDotNet/Exporters/FullNameProvider.cs +++ b/src/BenchmarkDotNet/Exporters/FullNameProvider.cs @@ -10,8 +10,6 @@ using BenchmarkDotNet.Running; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Exporters { public static class FullNameProvider diff --git a/src/BenchmarkDotNet/Exporters/InstructionPointerExporter.cs b/src/BenchmarkDotNet/Exporters/InstructionPointerExporter.cs index 7cfd00e8a4..f42066e5f6 100644 --- a/src/BenchmarkDotNet/Exporters/InstructionPointerExporter.cs +++ b/src/BenchmarkDotNet/Exporters/InstructionPointerExporter.cs @@ -10,8 +10,6 @@ using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Exporters { internal class InstructionPointerExporter : IExporter diff --git a/src/BenchmarkDotNet/Exporters/Json/JsonExporterBase.cs b/src/BenchmarkDotNet/Exporters/Json/JsonExporterBase.cs index c22d89bb93..6f9e6bbd67 100644 --- a/src/BenchmarkDotNet/Exporters/Json/JsonExporterBase.cs +++ b/src/BenchmarkDotNet/Exporters/Json/JsonExporterBase.cs @@ -7,8 +7,6 @@ using System.Collections.Generic; using System.Linq; -#nullable enable - namespace BenchmarkDotNet.Exporters.Json { public abstract class JsonExporterBase : ExporterBase diff --git a/src/BenchmarkDotNet/Exporters/MarkdownExporter.cs b/src/BenchmarkDotNet/Exporters/MarkdownExporter.cs index c04e3d820d..73a4358c23 100644 --- a/src/BenchmarkDotNet/Exporters/MarkdownExporter.cs +++ b/src/BenchmarkDotNet/Exporters/MarkdownExporter.cs @@ -3,8 +3,6 @@ using BenchmarkDotNet.Reports; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Exporters { public class MarkdownExporter : ExporterBase diff --git a/src/BenchmarkDotNet/Exporters/RPlotExporter.cs b/src/BenchmarkDotNet/Exporters/RPlotExporter.cs index 1304bf1443..1b0bc8610d 100644 --- a/src/BenchmarkDotNet/Exporters/RPlotExporter.cs +++ b/src/BenchmarkDotNet/Exporters/RPlotExporter.cs @@ -10,8 +10,6 @@ using BenchmarkDotNet.Properties; using BenchmarkDotNet.Reports; -#nullable enable - namespace BenchmarkDotNet.Exporters { public class RPlotExporter : IExporter, IExporterDependencies diff --git a/src/BenchmarkDotNet/Exporters/Xml/SummaryDto.cs b/src/BenchmarkDotNet/Exporters/Xml/SummaryDto.cs index 0e8663c6c7..10cc44e55e 100644 --- a/src/BenchmarkDotNet/Exporters/Xml/SummaryDto.cs +++ b/src/BenchmarkDotNet/Exporters/Xml/SummaryDto.cs @@ -9,8 +9,6 @@ // ReSharper disable UnusedMember.Global -#nullable enable - namespace BenchmarkDotNet.Exporters.Xml { internal class SummaryDto diff --git a/src/BenchmarkDotNet/Exporters/Xml/XmlSerializer.cs b/src/BenchmarkDotNet/Exporters/Xml/XmlSerializer.cs index c08d1effd6..5adf35bf01 100644 --- a/src/BenchmarkDotNet/Exporters/Xml/XmlSerializer.cs +++ b/src/BenchmarkDotNet/Exporters/Xml/XmlSerializer.cs @@ -6,8 +6,6 @@ using System.Linq; using System.Reflection; -#nullable enable - namespace BenchmarkDotNet.Exporters.Xml { internal class XmlSerializer : IXmlSerializer diff --git a/src/BenchmarkDotNet/Extensions/CommonExtensions.cs b/src/BenchmarkDotNet/Extensions/CommonExtensions.cs index 391dfac980..09d9b711c8 100644 --- a/src/BenchmarkDotNet/Extensions/CommonExtensions.cs +++ b/src/BenchmarkDotNet/Extensions/CommonExtensions.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Columns; using BenchmarkDotNet.Reports; -#nullable enable - namespace BenchmarkDotNet.Extensions { internal static class CommonExtensions diff --git a/src/BenchmarkDotNet/Extensions/PathFeatures.cs b/src/BenchmarkDotNet/Extensions/PathFeatures.cs index 070ecbf8a9..b52075a31b 100644 --- a/src/BenchmarkDotNet/Extensions/PathFeatures.cs +++ b/src/BenchmarkDotNet/Extensions/PathFeatures.cs @@ -8,8 +8,6 @@ using System.Reflection; using System.Runtime.InteropServices; -#nullable enable - namespace BenchmarkDotNet.Extensions { internal static class PathFeatures diff --git a/src/BenchmarkDotNet/Extensions/ProcessExtensions.cs b/src/BenchmarkDotNet/Extensions/ProcessExtensions.cs index 54aff5b572..987eb557d8 100644 --- a/src/BenchmarkDotNet/Extensions/ProcessExtensions.cs +++ b/src/BenchmarkDotNet/Extensions/ProcessExtensions.cs @@ -15,8 +15,6 @@ using System.Diagnostics; using System.IO; -#nullable enable - namespace BenchmarkDotNet.Extensions { // we need it public to reuse it in the auto-generated dll diff --git a/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs b/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs index 2a445b5fe3..a5b1839d13 100644 --- a/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs +++ b/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs @@ -5,8 +5,6 @@ using System.Reflection; using BenchmarkDotNet.Attributes; -#nullable enable - namespace BenchmarkDotNet.Extensions { internal static class ReflectionExtensions diff --git a/src/BenchmarkDotNet/Extensions/StringAndTextExtensions.cs b/src/BenchmarkDotNet/Extensions/StringAndTextExtensions.cs index 3d68f3d4c2..838ac015b7 100644 --- a/src/BenchmarkDotNet/Extensions/StringAndTextExtensions.cs +++ b/src/BenchmarkDotNet/Extensions/StringAndTextExtensions.cs @@ -6,8 +6,6 @@ using System.Text; using System.Text.RegularExpressions; -#nullable enable - namespace BenchmarkDotNet.Extensions { // Renamed to "StringAndTextExtensions", so it doesn't clash with "StringExtensions" in BenchmarkDotNet.Portability diff --git a/src/BenchmarkDotNet/Helpers/AsciiHelper.cs b/src/BenchmarkDotNet/Helpers/AsciiHelper.cs index 9169f28d20..a0ceff7252 100644 --- a/src/BenchmarkDotNet/Helpers/AsciiHelper.cs +++ b/src/BenchmarkDotNet/Helpers/AsciiHelper.cs @@ -1,5 +1,3 @@ -#nullable enable - namespace BenchmarkDotNet.Helpers { internal static class AsciiHelper diff --git a/src/BenchmarkDotNet/Helpers/AwaitHelper.cs b/src/BenchmarkDotNet/Helpers/AwaitHelper.cs index c5817ff76e..e11e25b015 100644 --- a/src/BenchmarkDotNet/Helpers/AwaitHelper.cs +++ b/src/BenchmarkDotNet/Helpers/AwaitHelper.cs @@ -5,8 +5,6 @@ using System.Threading; using System.Threading.Tasks; -#nullable enable - namespace BenchmarkDotNet.Helpers { public static class AwaitHelper diff --git a/src/BenchmarkDotNet/Helpers/ConsoleExitHandler.cs b/src/BenchmarkDotNet/Helpers/ConsoleExitHandler.cs index e81bdc411b..f70ac03b2d 100644 --- a/src/BenchmarkDotNet/Helpers/ConsoleExitHandler.cs +++ b/src/BenchmarkDotNet/Helpers/ConsoleExitHandler.cs @@ -3,8 +3,6 @@ using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Loggers; -#nullable enable - namespace BenchmarkDotNet.Helpers { internal class ConsoleExitHandler : IDisposable diff --git a/src/BenchmarkDotNet/Helpers/DirtyAssemblyResolveHelper.cs b/src/BenchmarkDotNet/Helpers/DirtyAssemblyResolveHelper.cs index 9205c3da3c..05aa9a24fc 100644 --- a/src/BenchmarkDotNet/Helpers/DirtyAssemblyResolveHelper.cs +++ b/src/BenchmarkDotNet/Helpers/DirtyAssemblyResolveHelper.cs @@ -2,8 +2,6 @@ using System.IO; using System.Reflection; -#nullable enable - // THIS TYPE MUST NOT HAVE ANY DEPENDENCIES TO BENCHMARKDOTNET, VALUE TUPLE, IMMUTABLE TYPES OR ANYTHING COMPLEX!! /// diff --git a/src/BenchmarkDotNet/Helpers/ExternalToolsHelper.cs b/src/BenchmarkDotNet/Helpers/ExternalToolsHelper.cs index 5abad2f598..d015e2c113 100644 --- a/src/BenchmarkDotNet/Helpers/ExternalToolsHelper.cs +++ b/src/BenchmarkDotNet/Helpers/ExternalToolsHelper.cs @@ -3,8 +3,6 @@ using BenchmarkDotNet.Detectors; using BenchmarkDotNet.Portability; -#nullable enable - namespace BenchmarkDotNet.Helpers { public static class ExternalToolsHelper diff --git a/src/BenchmarkDotNet/Helpers/FolderNameHelper.cs b/src/BenchmarkDotNet/Helpers/FolderNameHelper.cs index 417ceab613..9462b16537 100644 --- a/src/BenchmarkDotNet/Helpers/FolderNameHelper.cs +++ b/src/BenchmarkDotNet/Helpers/FolderNameHelper.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Extensions; using Perfolizer.Horology; -#nullable enable - namespace BenchmarkDotNet.Helpers { public static class FolderNameHelper diff --git a/src/BenchmarkDotNet/Helpers/HashCode.cs b/src/BenchmarkDotNet/Helpers/HashCode.cs index 120ff3cbc1..423e9036a2 100644 --- a/src/BenchmarkDotNet/Helpers/HashCode.cs +++ b/src/BenchmarkDotNet/Helpers/HashCode.cs @@ -3,8 +3,6 @@ using System.ComponentModel; using System.Runtime.CompilerServices; -#nullable enable - // Mimics System.HashCode, which is missing in NetStandard2.0. // Placed in root namespace to avoid ambiguous reference with System.HashCode diff --git a/src/BenchmarkDotNet/Helpers/LinuxOsReleaseHelper.cs b/src/BenchmarkDotNet/Helpers/LinuxOsReleaseHelper.cs index d328d7b131..381dd6a933 100644 --- a/src/BenchmarkDotNet/Helpers/LinuxOsReleaseHelper.cs +++ b/src/BenchmarkDotNet/Helpers/LinuxOsReleaseHelper.cs @@ -3,8 +3,6 @@ using System.Linq; using BenchmarkDotNet.Extensions; -#nullable enable - namespace BenchmarkDotNet.Helpers { internal static class LinuxOsReleaseHelper diff --git a/src/BenchmarkDotNet/Helpers/PowerManagementHelper.cs b/src/BenchmarkDotNet/Helpers/PowerManagementHelper.cs index e87dceb8db..ba7e6d776d 100644 --- a/src/BenchmarkDotNet/Helpers/PowerManagementHelper.cs +++ b/src/BenchmarkDotNet/Helpers/PowerManagementHelper.cs @@ -3,8 +3,6 @@ using System.Runtime.InteropServices; using System.Text; -#nullable enable - namespace BenchmarkDotNet.Helpers { [SuppressMessage("ReSharper", "InconsistentNaming")] diff --git a/src/BenchmarkDotNet/Helpers/Reflection.Emit/EmitParameterInfo.cs b/src/BenchmarkDotNet/Helpers/Reflection.Emit/EmitParameterInfo.cs index 2d4f55acd3..033b82e14c 100644 --- a/src/BenchmarkDotNet/Helpers/Reflection.Emit/EmitParameterInfo.cs +++ b/src/BenchmarkDotNet/Helpers/Reflection.Emit/EmitParameterInfo.cs @@ -1,8 +1,6 @@ using System; using System.Reflection; -#nullable enable - namespace BenchmarkDotNet.Helpers.Reflection.Emit { internal class EmitParameterInfo : ParameterInfo diff --git a/src/BenchmarkDotNet/Helpers/Reflection.Emit/IlGeneratorCallExtensions.cs b/src/BenchmarkDotNet/Helpers/Reflection.Emit/IlGeneratorCallExtensions.cs index f212933735..6e936de73b 100644 --- a/src/BenchmarkDotNet/Helpers/Reflection.Emit/IlGeneratorCallExtensions.cs +++ b/src/BenchmarkDotNet/Helpers/Reflection.Emit/IlGeneratorCallExtensions.cs @@ -3,8 +3,6 @@ using System.Reflection; using System.Reflection.Emit; -#nullable enable - namespace BenchmarkDotNet.Helpers.Reflection.Emit { internal static class IlGeneratorCallExtensions diff --git a/src/BenchmarkDotNet/Helpers/ResourceHelper.cs b/src/BenchmarkDotNet/Helpers/ResourceHelper.cs index 9dad2b5d08..fc369adb1d 100644 --- a/src/BenchmarkDotNet/Helpers/ResourceHelper.cs +++ b/src/BenchmarkDotNet/Helpers/ResourceHelper.cs @@ -2,8 +2,6 @@ using System.IO; using System.Reflection; -#nullable enable - namespace BenchmarkDotNet.Helpers { internal static class ResourceHelper diff --git a/src/BenchmarkDotNet/Helpers/SectionsHelper.cs b/src/BenchmarkDotNet/Helpers/SectionsHelper.cs index ec3ce95f99..e16442d0fb 100644 --- a/src/BenchmarkDotNet/Helpers/SectionsHelper.cs +++ b/src/BenchmarkDotNet/Helpers/SectionsHelper.cs @@ -3,8 +3,6 @@ using System.Linq; using System.Text.RegularExpressions; -#nullable enable - namespace BenchmarkDotNet.Helpers { internal static class SectionsHelper diff --git a/src/BenchmarkDotNet/Helpers/SourceCodeHelper.cs b/src/BenchmarkDotNet/Helpers/SourceCodeHelper.cs index 2aad47ffb4..a6bed34dfa 100644 --- a/src/BenchmarkDotNet/Helpers/SourceCodeHelper.cs +++ b/src/BenchmarkDotNet/Helpers/SourceCodeHelper.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Extensions; using Perfolizer.Horology; -#nullable enable - namespace BenchmarkDotNet.Helpers { public static class SourceCodeHelper diff --git a/src/BenchmarkDotNet/Jobs/Argument.cs b/src/BenchmarkDotNet/Jobs/Argument.cs index 15c08e4caf..36c45d04f2 100644 --- a/src/BenchmarkDotNet/Jobs/Argument.cs +++ b/src/BenchmarkDotNet/Jobs/Argument.cs @@ -1,8 +1,6 @@ using System; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Jobs { public abstract class Argument: IEquatable diff --git a/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs b/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs index cf970d6420..d7428364fa 100644 --- a/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs +++ b/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs @@ -7,8 +7,6 @@ using BenchmarkDotNet.Portability; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Jobs { public sealed class EnvironmentMode : JobMode diff --git a/src/BenchmarkDotNet/Jobs/EnvironmentVariable.cs b/src/BenchmarkDotNet/Jobs/EnvironmentVariable.cs index 985ef07bc5..b84dc5be6c 100644 --- a/src/BenchmarkDotNet/Jobs/EnvironmentVariable.cs +++ b/src/BenchmarkDotNet/Jobs/EnvironmentVariable.cs @@ -1,7 +1,5 @@ using System; -#nullable enable - namespace BenchmarkDotNet.Jobs { public class EnvironmentVariable : IEquatable diff --git a/src/BenchmarkDotNet/Jobs/GcMode.cs b/src/BenchmarkDotNet/Jobs/GcMode.cs index e836f43cc3..a87ea71664 100644 --- a/src/BenchmarkDotNet/Jobs/GcMode.cs +++ b/src/BenchmarkDotNet/Jobs/GcMode.cs @@ -2,8 +2,6 @@ using System.Diagnostics.CodeAnalysis; using BenchmarkDotNet.Characteristics; -#nullable enable - namespace BenchmarkDotNet.Jobs { [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] diff --git a/src/BenchmarkDotNet/Jobs/InfrastructureMode.cs b/src/BenchmarkDotNet/Jobs/InfrastructureMode.cs index 3cd45079c7..e06d212cb2 100644 --- a/src/BenchmarkDotNet/Jobs/InfrastructureMode.cs +++ b/src/BenchmarkDotNet/Jobs/InfrastructureMode.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Toolchains.InProcess.Emit; using Perfolizer.Horology; -#nullable enable - namespace BenchmarkDotNet.Jobs { [SuppressMessage("ReSharper", "UnusedMember.Global")] diff --git a/src/BenchmarkDotNet/Jobs/JobComparer.cs b/src/BenchmarkDotNet/Jobs/JobComparer.cs index 14f69dd9b2..575ce21eb9 100644 --- a/src/BenchmarkDotNet/Jobs/JobComparer.cs +++ b/src/BenchmarkDotNet/Jobs/JobComparer.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -#nullable enable - namespace BenchmarkDotNet.Jobs { internal class JobComparer : IComparer, IEqualityComparer diff --git a/src/BenchmarkDotNet/Jobs/JobExtensions.cs b/src/BenchmarkDotNet/Jobs/JobExtensions.cs index bf1afb49d6..3d4f65bc2f 100644 --- a/src/BenchmarkDotNet/Jobs/JobExtensions.cs +++ b/src/BenchmarkDotNet/Jobs/JobExtensions.cs @@ -12,8 +12,6 @@ using Perfolizer.Horology; using Perfolizer.Mathematics.OutlierDetection; -#nullable enable - namespace BenchmarkDotNet.Jobs { public static class JobExtensions diff --git a/src/BenchmarkDotNet/Jobs/JobMode`1.cs b/src/BenchmarkDotNet/Jobs/JobMode`1.cs index 4dfa8ebe21..c88fd99d94 100644 --- a/src/BenchmarkDotNet/Jobs/JobMode`1.cs +++ b/src/BenchmarkDotNet/Jobs/JobMode`1.cs @@ -1,8 +1,6 @@ using BenchmarkDotNet.Characteristics; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Jobs { public abstract class JobMode : CharacteristicObject where T : JobMode, new() diff --git a/src/BenchmarkDotNet/Jobs/RunMode.cs b/src/BenchmarkDotNet/Jobs/RunMode.cs index fe3e144823..af47701511 100644 --- a/src/BenchmarkDotNet/Jobs/RunMode.cs +++ b/src/BenchmarkDotNet/Jobs/RunMode.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Models; using Perfolizer.Horology; -#nullable enable - namespace BenchmarkDotNet.Jobs { [SuppressMessage("ReSharper", "UnusedMember.Global")] diff --git a/src/BenchmarkDotNet/Loggers/AsyncProcessOutputReader.cs b/src/BenchmarkDotNet/Loggers/AsyncProcessOutputReader.cs index 6a33602cae..611f7d7468 100644 --- a/src/BenchmarkDotNet/Loggers/AsyncProcessOutputReader.cs +++ b/src/BenchmarkDotNet/Loggers/AsyncProcessOutputReader.cs @@ -5,8 +5,6 @@ using System.Linq; using System.Threading; -#nullable enable - namespace BenchmarkDotNet.Loggers { internal class AsyncProcessOutputReader : IDisposable diff --git a/src/BenchmarkDotNet/Loggers/Broker.cs b/src/BenchmarkDotNet/Loggers/Broker.cs index 44d7285b46..08c4cea717 100644 --- a/src/BenchmarkDotNet/Loggers/Broker.cs +++ b/src/BenchmarkDotNet/Loggers/Broker.cs @@ -8,8 +8,6 @@ using BenchmarkDotNet.Engines; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Loggers { internal class Broker : IDisposable diff --git a/src/BenchmarkDotNet/Loggers/LinqPadLogger.cs b/src/BenchmarkDotNet/Loggers/LinqPadLogger.cs index c5193bcd87..6319fc73f6 100644 --- a/src/BenchmarkDotNet/Loggers/LinqPadLogger.cs +++ b/src/BenchmarkDotNet/Loggers/LinqPadLogger.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Reflection; -#nullable enable - namespace BenchmarkDotNet.Loggers { public sealed class LinqPadLogger : ILogger diff --git a/src/BenchmarkDotNet/Loggers/LoggerExtensions.cs b/src/BenchmarkDotNet/Loggers/LoggerExtensions.cs index 84b24a6d09..1d75341bb8 100644 --- a/src/BenchmarkDotNet/Loggers/LoggerExtensions.cs +++ b/src/BenchmarkDotNet/Loggers/LoggerExtensions.cs @@ -1,7 +1,5 @@ using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Loggers { public static class LoggerExtensions diff --git a/src/BenchmarkDotNet/Mathematics/Statistics.cs b/src/BenchmarkDotNet/Mathematics/Statistics.cs index 19d52fcf36..8c37ad6713 100644 --- a/src/BenchmarkDotNet/Mathematics/Statistics.cs +++ b/src/BenchmarkDotNet/Mathematics/Statistics.cs @@ -10,8 +10,6 @@ using Perfolizer.Mathematics.QuantileEstimators; using Pragmastat; -#nullable enable - namespace BenchmarkDotNet.Mathematics { public class Statistics diff --git a/src/BenchmarkDotNet/Order/CategoryComparer.cs b/src/BenchmarkDotNet/Order/CategoryComparer.cs index 669436abfa..88a4c3c5b7 100644 --- a/src/BenchmarkDotNet/Order/CategoryComparer.cs +++ b/src/BenchmarkDotNet/Order/CategoryComparer.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Linq; -#nullable enable - namespace BenchmarkDotNet.Order { internal class CategoryComparer : IComparer diff --git a/src/BenchmarkDotNet/Order/DefaultOrderer.cs b/src/BenchmarkDotNet/Order/DefaultOrderer.cs index a361d7b521..cded96fae1 100644 --- a/src/BenchmarkDotNet/Order/DefaultOrderer.cs +++ b/src/BenchmarkDotNet/Order/DefaultOrderer.cs @@ -11,8 +11,6 @@ using BenchmarkDotNet.Running; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Order { [SuppressMessage("ReSharper", "ClassWithVirtualMembersNeverInherited.Global")] diff --git a/src/BenchmarkDotNet/Parameters/ParameterComparer.cs b/src/BenchmarkDotNet/Parameters/ParameterComparer.cs index 8edc0035af..feca5249bc 100644 --- a/src/BenchmarkDotNet/Parameters/ParameterComparer.cs +++ b/src/BenchmarkDotNet/Parameters/ParameterComparer.cs @@ -9,8 +9,6 @@ using System.Linq; #endif -#nullable enable - namespace BenchmarkDotNet.Parameters { internal class ParameterComparer : IComparer diff --git a/src/BenchmarkDotNet/Parameters/ParameterDefinition.cs b/src/BenchmarkDotNet/Parameters/ParameterDefinition.cs index 45c45c07e9..6fd2ec6afe 100644 --- a/src/BenchmarkDotNet/Parameters/ParameterDefinition.cs +++ b/src/BenchmarkDotNet/Parameters/ParameterDefinition.cs @@ -1,7 +1,5 @@ using System; -#nullable enable - namespace BenchmarkDotNet.Parameters { public class ParameterDefinition diff --git a/src/BenchmarkDotNet/Parameters/ParameterEqualityComparer.cs b/src/BenchmarkDotNet/Parameters/ParameterEqualityComparer.cs index 797b8ae9dc..fbd503cfee 100644 --- a/src/BenchmarkDotNet/Parameters/ParameterEqualityComparer.cs +++ b/src/BenchmarkDotNet/Parameters/ParameterEqualityComparer.cs @@ -9,8 +9,6 @@ using System.Linq; #endif -#nullable enable - namespace BenchmarkDotNet.Parameters { internal class ParameterEqualityComparer : IEqualityComparer diff --git a/src/BenchmarkDotNet/Parameters/ParameterInstance.cs b/src/BenchmarkDotNet/Parameters/ParameterInstance.cs index 132acd0043..2bf95a5785 100644 --- a/src/BenchmarkDotNet/Parameters/ParameterInstance.cs +++ b/src/BenchmarkDotNet/Parameters/ParameterInstance.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Reports; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Parameters { public class ParameterInstance : IDisposable diff --git a/src/BenchmarkDotNet/Parameters/ParameterInstances.cs b/src/BenchmarkDotNet/Parameters/ParameterInstances.cs index 8251935281..e0eddb9bf3 100644 --- a/src/BenchmarkDotNet/Parameters/ParameterInstances.cs +++ b/src/BenchmarkDotNet/Parameters/ParameterInstances.cs @@ -3,8 +3,6 @@ using System.Linq; using BenchmarkDotNet.Extensions; -#nullable enable - namespace BenchmarkDotNet.Parameters { public class ParameterInstances : IEquatable, IDisposable diff --git a/src/BenchmarkDotNet/Parameters/SmartParamBuilder.cs b/src/BenchmarkDotNet/Parameters/SmartParamBuilder.cs index 699d4d263d..af0d274ac9 100644 --- a/src/BenchmarkDotNet/Parameters/SmartParamBuilder.cs +++ b/src/BenchmarkDotNet/Parameters/SmartParamBuilder.cs @@ -10,8 +10,6 @@ using BenchmarkDotNet.Reports; using BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation; -#nullable enable - namespace BenchmarkDotNet.Parameters { internal static class SmartParamBuilder diff --git a/src/BenchmarkDotNet/Portability/RuntimeInformation.cs b/src/BenchmarkDotNet/Portability/RuntimeInformation.cs index ab6604b957..bd0b62d0e8 100644 --- a/src/BenchmarkDotNet/Portability/RuntimeInformation.cs +++ b/src/BenchmarkDotNet/Portability/RuntimeInformation.cs @@ -14,8 +14,6 @@ using BenchmarkDotNet.Helpers; using static System.Runtime.InteropServices.RuntimeInformation; -#nullable enable - namespace BenchmarkDotNet.Portability { internal static class RuntimeInformation diff --git a/src/BenchmarkDotNet/Properties/BenchmarkDotNetInfo.cs b/src/BenchmarkDotNet/Properties/BenchmarkDotNetInfo.cs index fe33bfea54..d2f50550db 100644 --- a/src/BenchmarkDotNet/Properties/BenchmarkDotNetInfo.cs +++ b/src/BenchmarkDotNet/Properties/BenchmarkDotNetInfo.cs @@ -3,8 +3,6 @@ using BenchmarkDotNet.Extensions; using Perfolizer.Models; -#nullable enable - namespace BenchmarkDotNet.Properties { public class BenchmarkDotNetInfo diff --git a/src/BenchmarkDotNet/Reports/BenchmarkReport.cs b/src/BenchmarkDotNet/Reports/BenchmarkReport.cs index 1af6ede786..4a7718b9fb 100644 --- a/src/BenchmarkDotNet/Reports/BenchmarkReport.cs +++ b/src/BenchmarkDotNet/Reports/BenchmarkReport.cs @@ -12,8 +12,6 @@ using Perfolizer.Horology; using Perfolizer.Models; -#nullable enable - namespace BenchmarkDotNet.Reports { public sealed class BenchmarkReport diff --git a/src/BenchmarkDotNet/Reports/Metric.cs b/src/BenchmarkDotNet/Reports/Metric.cs index dfa0421e0c..4ebad826bb 100644 --- a/src/BenchmarkDotNet/Reports/Metric.cs +++ b/src/BenchmarkDotNet/Reports/Metric.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -#nullable enable - namespace BenchmarkDotNet.Reports { public class Metric diff --git a/src/BenchmarkDotNet/Reports/Summary.cs b/src/BenchmarkDotNet/Reports/Summary.cs index e7ee4aa6eb..a67f8e01ca 100644 --- a/src/BenchmarkDotNet/Reports/Summary.cs +++ b/src/BenchmarkDotNet/Reports/Summary.cs @@ -16,8 +16,6 @@ using Perfolizer.Models; using Perfolizer.Perfonar.Tables; -#nullable enable - namespace BenchmarkDotNet.Reports { public class Summary diff --git a/src/BenchmarkDotNet/Reports/SummaryExtensions.cs b/src/BenchmarkDotNet/Reports/SummaryExtensions.cs index ebf6b75811..e9355962c9 100644 --- a/src/BenchmarkDotNet/Reports/SummaryExtensions.cs +++ b/src/BenchmarkDotNet/Reports/SummaryExtensions.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Running; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Reports { public static class SummaryExtensions diff --git a/src/BenchmarkDotNet/Reports/SummaryStyle.cs b/src/BenchmarkDotNet/Reports/SummaryStyle.cs index 1958accf56..affd98c150 100644 --- a/src/BenchmarkDotNet/Reports/SummaryStyle.cs +++ b/src/BenchmarkDotNet/Reports/SummaryStyle.cs @@ -8,8 +8,6 @@ // ReSharper disable MemberCanBePrivate.Global -#nullable enable - namespace BenchmarkDotNet.Reports { public class SummaryStyle : IEquatable diff --git a/src/BenchmarkDotNet/Reports/SummaryTable.cs b/src/BenchmarkDotNet/Reports/SummaryTable.cs index 90ac68183d..4cd5bba8bb 100644 --- a/src/BenchmarkDotNet/Reports/SummaryTable.cs +++ b/src/BenchmarkDotNet/Reports/SummaryTable.cs @@ -7,8 +7,6 @@ using Perfolizer.Horology; using Perfolizer.Metrology; -#nullable enable - namespace BenchmarkDotNet.Reports { public class SummaryTable diff --git a/src/BenchmarkDotNet/Reports/SummaryTableExtensions.cs b/src/BenchmarkDotNet/Reports/SummaryTableExtensions.cs index 6d1e567a1e..b1b4460bcd 100644 --- a/src/BenchmarkDotNet/Reports/SummaryTableExtensions.cs +++ b/src/BenchmarkDotNet/Reports/SummaryTableExtensions.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Loggers; -#nullable enable - namespace BenchmarkDotNet.Reports { public static class SummaryTableExtensions diff --git a/src/BenchmarkDotNet/Running/BenchmarkCase.cs b/src/BenchmarkDotNet/Running/BenchmarkCase.cs index 999a622227..f6ca11a456 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkCase.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkCase.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Parameters; using BenchmarkDotNet.Portability; -#nullable enable - namespace BenchmarkDotNet.Running { public class BenchmarkCase : IComparable, IDisposable diff --git a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs index 756f252a4f..dba2b1f31b 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs @@ -12,8 +12,6 @@ using BenchmarkDotNet.Parameters; using BenchmarkDotNet.Reports; -#nullable enable - namespace BenchmarkDotNet.Running { public static class BenchmarkConverter diff --git a/src/BenchmarkDotNet/Running/BenchmarkId.cs b/src/BenchmarkDotNet/Running/BenchmarkId.cs index c5c867bf6d..abb16c8924 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkId.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkId.cs @@ -4,8 +4,6 @@ using BenchmarkDotNet.Extensions; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Running { /// diff --git a/src/BenchmarkDotNet/Running/BenchmarkPartitioner.cs b/src/BenchmarkDotNet/Running/BenchmarkPartitioner.cs index 1b7ed2da5e..1371360c3e 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkPartitioner.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkPartitioner.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Toolchains; -#nullable enable - namespace BenchmarkDotNet.Running { public static class BenchmarkPartitioner diff --git a/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs b/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs index 0279ac6d0b..a49a746898 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs @@ -28,8 +28,6 @@ using Perfolizer.Horology; using RunMode = BenchmarkDotNet.Jobs.RunMode; -#nullable enable - namespace BenchmarkDotNet.Running { internal static class BenchmarkRunnerClean diff --git a/src/BenchmarkDotNet/Running/BenchmarkSwitcher.cs b/src/BenchmarkDotNet/Running/BenchmarkSwitcher.cs index 2e26fdab8d..69f75c7e77 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkSwitcher.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkSwitcher.cs @@ -16,8 +16,6 @@ using JetBrains.Annotations; using Perfolizer.Mathematics.OutlierDetection; -#nullable enable - namespace BenchmarkDotNet.Running { public class BenchmarkSwitcher diff --git a/src/BenchmarkDotNet/Running/BuildPartition.cs b/src/BenchmarkDotNet/Running/BuildPartition.cs index 38bb8c53be..ef6e5c48f1 100644 --- a/src/BenchmarkDotNet/Running/BuildPartition.cs +++ b/src/BenchmarkDotNet/Running/BuildPartition.cs @@ -15,8 +15,6 @@ using BenchmarkDotNet.Toolchains.Roslyn; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Running { public class BuildPartition diff --git a/src/BenchmarkDotNet/Running/ConsoleTitler.cs b/src/BenchmarkDotNet/Running/ConsoleTitler.cs index d36798fa7f..8579744edc 100644 --- a/src/BenchmarkDotNet/Running/ConsoleTitler.cs +++ b/src/BenchmarkDotNet/Running/ConsoleTitler.cs @@ -4,8 +4,6 @@ using BenchmarkDotNet.Detectors; using BenchmarkDotNet.Helpers; -#nullable enable - namespace BenchmarkDotNet.Running { /// diff --git a/src/BenchmarkDotNet/Running/DescriptorComparer.cs b/src/BenchmarkDotNet/Running/DescriptorComparer.cs index 493f7dd20a..6c45d9f5a7 100644 --- a/src/BenchmarkDotNet/Running/DescriptorComparer.cs +++ b/src/BenchmarkDotNet/Running/DescriptorComparer.cs @@ -3,8 +3,6 @@ using BenchmarkDotNet.Order; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Running { internal class DescriptorComparer : IComparer diff --git a/src/BenchmarkDotNet/Running/UserInteraction.cs b/src/BenchmarkDotNet/Running/UserInteraction.cs index 099905c1a1..e54731906c 100644 --- a/src/BenchmarkDotNet/Running/UserInteraction.cs +++ b/src/BenchmarkDotNet/Running/UserInteraction.cs @@ -8,8 +8,6 @@ using BenchmarkDotNet.Loggers; using BenchmarkDotNet.Portability; -#nullable enable - namespace BenchmarkDotNet.Running { internal class UserInteraction : IUserInteraction diff --git a/src/BenchmarkDotNet/Serialization/BdnJsonSerializer.cs b/src/BenchmarkDotNet/Serialization/BdnJsonSerializer.cs index 865a666158..90cc4684b4 100644 --- a/src/BenchmarkDotNet/Serialization/BdnJsonSerializer.cs +++ b/src/BenchmarkDotNet/Serialization/BdnJsonSerializer.cs @@ -4,8 +4,6 @@ namespace BenchmarkDotNet.Serialization; -#nullable enable - internal static class BdnJsonSerializer { private static readonly JsonSerializerOptions DefaultOptions = new() diff --git a/src/BenchmarkDotNet/Toolchains/AppConfigGenerator.cs b/src/BenchmarkDotNet/Toolchains/AppConfigGenerator.cs index 7f1857d0ff..707ecd3d86 100644 --- a/src/BenchmarkDotNet/Toolchains/AppConfigGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/AppConfigGenerator.cs @@ -8,8 +8,6 @@ using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Jobs; -#nullable enable - namespace BenchmarkDotNet.Toolchains { internal static class AppConfigGenerator diff --git a/src/BenchmarkDotNet/Toolchains/ArtifactsPaths.cs b/src/BenchmarkDotNet/Toolchains/ArtifactsPaths.cs index 4358aca4ce..904fd3ffb6 100644 --- a/src/BenchmarkDotNet/Toolchains/ArtifactsPaths.cs +++ b/src/BenchmarkDotNet/Toolchains/ArtifactsPaths.cs @@ -1,8 +1,6 @@ using BenchmarkDotNet.Extensions; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains { public class ArtifactsPaths diff --git a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunGenerator.cs b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunGenerator.cs index 17ce4c1a67..974e371e68 100644 --- a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunGenerator.cs @@ -2,8 +2,6 @@ using System.Linq; using BenchmarkDotNet.Toolchains.CsProj; -#nullable enable - namespace BenchmarkDotNet.Toolchains.CoreRun { public class CoreRunGenerator : CsProjGenerator diff --git a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunPublisher.cs b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunPublisher.cs index 7f3b034d58..0e4a191bb7 100644 --- a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunPublisher.cs +++ b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunPublisher.cs @@ -7,8 +7,6 @@ using BenchmarkDotNet.Toolchains.DotNetCli; using BenchmarkDotNet.Toolchains.Results; -#nullable enable - namespace BenchmarkDotNet.Toolchains.CoreRun { public class CoreRunPublisher(string tfm, FileInfo coreRun, FileInfo? customDotNetCliPath = null) : DotNetCliPublisher(tfm, customDotNetCliPath?.FullName ?? "") diff --git a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunToolchain.cs b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunToolchain.cs index 61849b3710..70ffb09cb6 100644 --- a/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/CoreRun/CoreRunToolchain.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Toolchains.DotNetCli; using BenchmarkDotNet.Validators; -#nullable enable - namespace BenchmarkDotNet.Toolchains.CoreRun { public class CoreRunToolchain : IToolchain diff --git a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjClassicNetToolchain.cs b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjClassicNetToolchain.cs index de25331ada..dbadfb79ba 100644 --- a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjClassicNetToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjClassicNetToolchain.cs @@ -8,8 +8,6 @@ using BenchmarkDotNet.Validators; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.CsProj { /// diff --git a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs index b31b02b353..4ea18a636b 100644 --- a/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs @@ -18,8 +18,6 @@ using BenchmarkDotNet.Toolchains.Results; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.CsProj { [PublicAPI] diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs index 86fbfb4c8f..abb4d7566a 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/CustomDotNetCliToolchainBuilder.cs @@ -11,8 +11,6 @@ using Microsoft.DotNet.PlatformAbstractions; #endif -#nullable enable - namespace BenchmarkDotNet.Toolchains.DotNetCli { [SuppressMessage("ReSharper", "InconsistentNaming")] diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliBuilder.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliBuilder.cs index f0f2065a4d..23688a8632 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliBuilder.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliBuilder.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Toolchains.Results; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.DotNetCli { [PublicAPI] diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs index 4b4f43cbac..98e54ded27 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs @@ -13,8 +13,6 @@ using BenchmarkDotNet.Toolchains.Results; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.DotNetCli { public class DotNetCliCommand diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs index 85a5995b2d..7b3ddc312f 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommandExecutor.cs @@ -15,8 +15,6 @@ using BenchmarkDotNet.Toolchains.Results; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.DotNetCli { [PublicAPI] diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliGenerator.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliGenerator.cs index 6719028cbd..19ceb7a0d5 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliGenerator.cs @@ -7,8 +7,6 @@ using BenchmarkDotNet.Running; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.DotNetCli { [PublicAPI] diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliPublisher.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliPublisher.cs index 5e3b2a103e..8c5b4984bc 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliPublisher.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliPublisher.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Running; using BenchmarkDotNet.Toolchains.Results; -#nullable enable - namespace BenchmarkDotNet.Toolchains.DotNetCli; public class DotNetCliPublisher : IBuilder diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/MsBuildErrorMapper.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/MsBuildErrorMapper.cs index edd33674e2..49882626fd 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/MsBuildErrorMapper.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/MsBuildErrorMapper.cs @@ -5,8 +5,6 @@ using System.Linq; using System.Text.RegularExpressions; -#nullable enable - namespace BenchmarkDotNet.Toolchains.DotNetCli { internal static class MsBuildErrorMapper diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs index 34e8d5d0e5..0b3aeeb30f 100644 --- a/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs +++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/NetCoreAppSettings.cs @@ -3,8 +3,6 @@ using BenchmarkDotNet.Toolchains.MonoAotLLVM; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.DotNetCli { /// diff --git a/src/BenchmarkDotNet/Toolchains/Executor.cs b/src/BenchmarkDotNet/Toolchains/Executor.cs index 562e000470..d0caa3d29c 100644 --- a/src/BenchmarkDotNet/Toolchains/Executor.cs +++ b/src/BenchmarkDotNet/Toolchains/Executor.cs @@ -19,8 +19,6 @@ using BenchmarkDotNet.Toolchains.Results; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains { [PublicAPI("Used by some of our Superusers that implement their own Toolchains (e.g. Kestrel team)")] diff --git a/src/BenchmarkDotNet/Toolchains/GeneratorBase.cs b/src/BenchmarkDotNet/Toolchains/GeneratorBase.cs index b358e4105a..eb97178ae0 100644 --- a/src/BenchmarkDotNet/Toolchains/GeneratorBase.cs +++ b/src/BenchmarkDotNet/Toolchains/GeneratorBase.cs @@ -10,8 +10,6 @@ using JetBrains.Annotations; using StreamWriter = System.IO.StreamWriter; -#nullable enable - namespace BenchmarkDotNet.Toolchains { [PublicAPI] diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/ConsumableTypeInfo.cs b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/ConsumableTypeInfo.cs index 2786c3dc3d..1978751396 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/ConsumableTypeInfo.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/ConsumableTypeInfo.cs @@ -4,8 +4,6 @@ using System.Threading.Tasks; using static BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation.RunnableReflectionHelpers; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation { public class ConsumableTypeInfo diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/EmitExtensions.cs b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/EmitExtensions.cs index 0c3a44ff90..39c1db2f13 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/EmitExtensions.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/EmitExtensions.cs @@ -4,8 +4,6 @@ using System.Reflection.Emit; using System.Runtime.ExceptionServices; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation { /// diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/RunnableEmitter.cs b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/RunnableEmitter.cs index ff1e189b52..ee9623a914 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/RunnableEmitter.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Emitters/RunnableEmitter.cs @@ -18,8 +18,6 @@ using static BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation.RunnableConstants; using static BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation.RunnableReflectionHelpers; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation { /// diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableProgram.cs b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableProgram.cs index 6b00f1ce3f..294555415d 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableProgram.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableProgram.cs @@ -6,8 +6,6 @@ using static BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation.RunnableConstants; using static BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation.RunnableReflectionHelpers; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation { internal class RunnableProgram diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReflectionHelpers.cs b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReflectionHelpers.cs index 7cde650e44..f10eaf52a8 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReflectionHelpers.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReflectionHelpers.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Running; using static BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation.RunnableConstants; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation { internal static class RunnableReflectionHelpers diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReuse.cs b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReuse.cs index b074fe006d..97971cca64 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReuse.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/Implementation/Runnable/RunnableReuse.cs @@ -10,8 +10,6 @@ using static BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation.RunnableConstants; using static BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation.RunnableReflectionHelpers; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation { public static class RunnableReuse diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitBuilder.cs b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitBuilder.cs index 3e4e8200a1..777bd8c718 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitBuilder.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitBuilder.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation; using BenchmarkDotNet.Toolchains.Results; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.Emit { public class InProcessEmitBuilder : IBuilder diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitGenerator.cs b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitGenerator.cs index 0f855a0cae..49a727f822 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/Emit/InProcessEmitGenerator.cs @@ -6,8 +6,6 @@ using System.Collections.Generic; using System.IO; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.Emit { public class InProcessEmitGenerator : IGenerator diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/InProcessHost.cs b/src/BenchmarkDotNet/Toolchains/InProcess/InProcessHost.cs index bf093121b1..4c4b950253 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/InProcessHost.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/InProcessHost.cs @@ -12,8 +12,6 @@ using BenchmarkDotNet.Running; using BenchmarkDotNet.Validators; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess { /// Host API for in-process benchmarks. diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/InProcessValidator.cs b/src/BenchmarkDotNet/Toolchains/InProcess/InProcessValidator.cs index 2c7e280e2a..b3ac4a5ee6 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/InProcessValidator.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/InProcessValidator.cs @@ -12,8 +12,6 @@ using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess { /// diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkAction.cs b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkAction.cs index e8eb28e284..31f7250f99 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkAction.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkAction.cs @@ -1,7 +1,5 @@ using System; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.NoEmit { /// Common API to run the Setup/Clean/Idle/Run methods diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory.cs b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory.cs index a0982c84a7..de4d5979ba 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory.cs @@ -7,8 +7,6 @@ using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.NoEmit { /// Helper class that creates instances. diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory_Base.cs b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory_Base.cs index 9352052df7..36f85f2606 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory_Base.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory_Base.cs @@ -1,8 +1,6 @@ using System; using System.Reflection; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.NoEmit { /* diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory_Implementations.cs b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory_Implementations.cs index a56cbe9f2d..c98da9a4a7 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory_Implementations.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory_Implementations.cs @@ -4,8 +4,6 @@ using System.Runtime.CompilerServices; using System.Threading.Tasks; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.NoEmit { /* diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitExecutor.cs b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitExecutor.cs index 7773bd625c..10eaa4287b 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitExecutor.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitExecutor.cs @@ -11,8 +11,6 @@ using BenchmarkDotNet.Toolchains.Parameters; using BenchmarkDotNet.Toolchains.Results; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.NoEmit { internal class InProcessNoEmitExecutor(bool executeOnSeparateThread) : IExecutor diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitGenerator.cs b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitGenerator.cs index 5b340c1f95..1aa7bb41f3 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitGenerator.cs @@ -4,8 +4,6 @@ using BenchmarkDotNet.Running; using BenchmarkDotNet.Toolchains.Results; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.NoEmit { /// diff --git a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitRunner.cs b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitRunner.cs index d645d0a155..ad42066350 100644 --- a/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitRunner.cs +++ b/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitRunner.cs @@ -11,8 +11,6 @@ using BenchmarkDotNet.Validators; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.InProcess.NoEmit { /// diff --git a/src/BenchmarkDotNet/Toolchains/Mono/MonoAotBuilder.cs b/src/BenchmarkDotNet/Toolchains/Mono/MonoAotBuilder.cs index 243f049cb5..dc49b79c0d 100644 --- a/src/BenchmarkDotNet/Toolchains/Mono/MonoAotBuilder.cs +++ b/src/BenchmarkDotNet/Toolchains/Mono/MonoAotBuilder.cs @@ -9,8 +9,6 @@ using BenchmarkDotNet.Toolchains.Results; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.Mono { [PublicAPI] diff --git a/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs b/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs index 6e8ad948f4..cce1de07d9 100644 --- a/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/Mono/MonoToolchain.cs @@ -3,8 +3,6 @@ using JetBrains.Annotations; using System; -#nullable enable - namespace BenchmarkDotNet.Toolchains.Mono { [PublicAPI] diff --git a/src/BenchmarkDotNet/Toolchains/MonoAotLLVM/MonoAotLLVMGenerator.cs b/src/BenchmarkDotNet/Toolchains/MonoAotLLVM/MonoAotLLVMGenerator.cs index 7719f4e8a4..03396a2520 100644 --- a/src/BenchmarkDotNet/Toolchains/MonoAotLLVM/MonoAotLLVMGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/MonoAotLLVM/MonoAotLLVMGenerator.cs @@ -9,8 +9,6 @@ using BenchmarkDotNet.Toolchains.CsProj; using BenchmarkDotNet.Toolchains.DotNetCli; -#nullable enable - namespace BenchmarkDotNet.Toolchains.MonoAotLLVM { public class MonoAotLLVMGenerator : CsProjGenerator diff --git a/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmGenerator.cs b/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmGenerator.cs index 2b2dffd453..b42aef9e4b 100644 --- a/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/MonoWasm/WasmGenerator.cs @@ -8,8 +8,6 @@ using BenchmarkDotNet.Running; using BenchmarkDotNet.Toolchains.CsProj; -#nullable enable - namespace BenchmarkDotNet.Toolchains.MonoWasm { public class WasmGenerator : CsProjGenerator diff --git a/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs b/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs index f062ac86cd..b5c49af67e 100644 --- a/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs +++ b/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs @@ -16,8 +16,6 @@ using BenchmarkDotNet.Toolchains.CsProj; using BenchmarkDotNet.Toolchains.DotNetCli; -#nullable enable - namespace BenchmarkDotNet.Toolchains.NativeAot { /// diff --git a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs index 6c27fc7522..da92e9951c 100644 --- a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchain.cs @@ -4,8 +4,6 @@ using BenchmarkDotNet.Toolchains.DotNetCli; using BenchmarkDotNet.Validators; -#nullable enable - namespace BenchmarkDotNet.Toolchains.NativeAot { public class NativeAotToolchain : Toolchain diff --git a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs index a56c479408..35b654cf7b 100644 --- a/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs +++ b/src/BenchmarkDotNet/Toolchains/NativeAot/NativeAotToolchainBuilder.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Toolchains.DotNetCli; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.NativeAot { public class NativeAotToolchainBuilder : CustomDotNetCliToolchainBuilder diff --git a/src/BenchmarkDotNet/Toolchains/Parameters/ExecuteParameters.cs b/src/BenchmarkDotNet/Toolchains/Parameters/ExecuteParameters.cs index c9357e367c..86acdc65ff 100644 --- a/src/BenchmarkDotNet/Toolchains/Parameters/ExecuteParameters.cs +++ b/src/BenchmarkDotNet/Toolchains/Parameters/ExecuteParameters.cs @@ -5,8 +5,6 @@ using BenchmarkDotNet.Toolchains.Results; using System; -#nullable enable - namespace BenchmarkDotNet.Toolchains.Parameters { public class ExecuteParameters(BuildResult buildResult, BenchmarkCase benchmarkCase, BenchmarkId benchmarkId, diff --git a/src/BenchmarkDotNet/Toolchains/R2R/R2RGenerator.cs b/src/BenchmarkDotNet/Toolchains/R2R/R2RGenerator.cs index 7da862e9a1..526a32ca69 100644 --- a/src/BenchmarkDotNet/Toolchains/R2R/R2RGenerator.cs +++ b/src/BenchmarkDotNet/Toolchains/R2R/R2RGenerator.cs @@ -9,8 +9,6 @@ using BenchmarkDotNet.Toolchains.CsProj; using BenchmarkDotNet.Toolchains.DotNetCli; -#nullable enable - namespace BenchmarkDotNet.Toolchains.R2R { public class R2RGenerator : CsProjGenerator diff --git a/src/BenchmarkDotNet/Toolchains/R2R/R2RToolchain.cs b/src/BenchmarkDotNet/Toolchains/R2R/R2RToolchain.cs index 4cb37d81ef..84c37b214b 100644 --- a/src/BenchmarkDotNet/Toolchains/R2R/R2RToolchain.cs +++ b/src/BenchmarkDotNet/Toolchains/R2R/R2RToolchain.cs @@ -7,8 +7,6 @@ using System; using System.Collections.Generic; -#nullable enable - namespace BenchmarkDotNet.Toolchains.R2R { [PublicAPI] diff --git a/src/BenchmarkDotNet/Toolchains/Results/BuildResult.cs b/src/BenchmarkDotNet/Toolchains/Results/BuildResult.cs index 2883935956..89c7dff908 100644 --- a/src/BenchmarkDotNet/Toolchains/Results/BuildResult.cs +++ b/src/BenchmarkDotNet/Toolchains/Results/BuildResult.cs @@ -3,8 +3,6 @@ using BenchmarkDotNet.Toolchains.DotNetCli; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Toolchains.Results { [PublicAPI] diff --git a/src/BenchmarkDotNet/Toolchains/Results/ExecuteResult.cs b/src/BenchmarkDotNet/Toolchains/Results/ExecuteResult.cs index 32d541d01b..97832a0285 100644 --- a/src/BenchmarkDotNet/Toolchains/Results/ExecuteResult.cs +++ b/src/BenchmarkDotNet/Toolchains/Results/ExecuteResult.cs @@ -5,8 +5,6 @@ using System.Collections.Generic; using System.Linq; -#nullable enable - namespace BenchmarkDotNet.Toolchains.Results { public class ExecuteResult diff --git a/src/BenchmarkDotNet/Toolchains/Results/GenerateResult.cs b/src/BenchmarkDotNet/Toolchains/Results/GenerateResult.cs index aa97708498..26dbd7399d 100644 --- a/src/BenchmarkDotNet/Toolchains/Results/GenerateResult.cs +++ b/src/BenchmarkDotNet/Toolchains/Results/GenerateResult.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; -#nullable enable - namespace BenchmarkDotNet.Toolchains.Results { public class GenerateResult diff --git a/src/BenchmarkDotNet/Toolchains/Roslyn/Builder.cs b/src/BenchmarkDotNet/Toolchains/Roslyn/Builder.cs index 5ba6128e7b..e014f24a29 100644 --- a/src/BenchmarkDotNet/Toolchains/Roslyn/Builder.cs +++ b/src/BenchmarkDotNet/Toolchains/Roslyn/Builder.cs @@ -16,8 +16,6 @@ using Microsoft.CodeAnalysis.Emit; using OurPlatform = BenchmarkDotNet.Environments.Platform; -#nullable enable - namespace BenchmarkDotNet.Toolchains.Roslyn { [PublicAPI] diff --git a/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs b/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs index 57bb335d88..6ebe351a81 100644 --- a/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs +++ b/src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs @@ -15,8 +15,6 @@ using BenchmarkDotNet.Toolchains.NativeAot; using BenchmarkDotNet.Toolchains.Roslyn; -#nullable enable - namespace BenchmarkDotNet.Toolchains { internal static class ToolchainExtensions diff --git a/src/BenchmarkDotNet/Validators/BaselineValidator.cs b/src/BenchmarkDotNet/Validators/BaselineValidator.cs index 0068c1517d..88c2d47d3e 100644 --- a/src/BenchmarkDotNet/Validators/BaselineValidator.cs +++ b/src/BenchmarkDotNet/Validators/BaselineValidator.cs @@ -4,8 +4,6 @@ using System.Collections.Immutable; using System.Linq; -#nullable enable - namespace BenchmarkDotNet.Validators { public class BaselineValidator : IValidator diff --git a/src/BenchmarkDotNet/Validators/BenchmarkProcessValidator.cs b/src/BenchmarkDotNet/Validators/BenchmarkProcessValidator.cs index d9f0a5ab64..9e4a8005fc 100644 --- a/src/BenchmarkDotNet/Validators/BenchmarkProcessValidator.cs +++ b/src/BenchmarkDotNet/Validators/BenchmarkProcessValidator.cs @@ -7,8 +7,6 @@ using System.Linq; using System.Reflection; -#nullable enable - namespace BenchmarkDotNet.Validators { [UsedImplicitly] diff --git a/src/BenchmarkDotNet/Validators/CompilationValidator.cs b/src/BenchmarkDotNet/Validators/CompilationValidator.cs index d763f48092..fa24803dca 100644 --- a/src/BenchmarkDotNet/Validators/CompilationValidator.cs +++ b/src/BenchmarkDotNet/Validators/CompilationValidator.cs @@ -9,8 +9,6 @@ using Microsoft.CodeAnalysis.CSharp; using BenchmarkDotNet.Attributes; -#nullable enable - namespace BenchmarkDotNet.Validators { public class CompilationValidator : IValidator diff --git a/src/BenchmarkDotNet/Validators/ConfigValidator.cs b/src/BenchmarkDotNet/Validators/ConfigValidator.cs index 3b73ae72d4..808d349bf4 100644 --- a/src/BenchmarkDotNet/Validators/ConfigValidator.cs +++ b/src/BenchmarkDotNet/Validators/ConfigValidator.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Loggers; -#nullable enable - namespace BenchmarkDotNet.Validators { public class ConfigValidator : IValidator diff --git a/src/BenchmarkDotNet/Validators/DeferredExecutionValidator.cs b/src/BenchmarkDotNet/Validators/DeferredExecutionValidator.cs index fe0ccaa701..14da5fdf14 100644 --- a/src/BenchmarkDotNet/Validators/DeferredExecutionValidator.cs +++ b/src/BenchmarkDotNet/Validators/DeferredExecutionValidator.cs @@ -5,8 +5,6 @@ using System.Threading.Tasks; using BenchmarkDotNet.Extensions; -#nullable enable - namespace BenchmarkDotNet.Validators { public class DeferredExecutionValidator : IValidator diff --git a/src/BenchmarkDotNet/Validators/DotNetSdkValidator.cs b/src/BenchmarkDotNet/Validators/DotNetSdkValidator.cs index 8f16547944..c78c86b079 100644 --- a/src/BenchmarkDotNet/Validators/DotNetSdkValidator.cs +++ b/src/BenchmarkDotNet/Validators/DotNetSdkValidator.cs @@ -11,8 +11,6 @@ using System.Linq; using System.Runtime.InteropServices; -#nullable enable - namespace BenchmarkDotNet.Validators { internal static class DotNetSdkValidator diff --git a/src/BenchmarkDotNet/Validators/ExecutionValidatorBase.cs b/src/BenchmarkDotNet/Validators/ExecutionValidatorBase.cs index b393d2849a..aa58076e96 100644 --- a/src/BenchmarkDotNet/Validators/ExecutionValidatorBase.cs +++ b/src/BenchmarkDotNet/Validators/ExecutionValidatorBase.cs @@ -9,8 +9,6 @@ using BenchmarkDotNet.Helpers; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Validators { public abstract class ExecutionValidatorBase : IValidator diff --git a/src/BenchmarkDotNet/Validators/ParamsAllValuesValidator.cs b/src/BenchmarkDotNet/Validators/ParamsAllValuesValidator.cs index c1b2563fc2..8f283f91be 100644 --- a/src/BenchmarkDotNet/Validators/ParamsAllValuesValidator.cs +++ b/src/BenchmarkDotNet/Validators/ParamsAllValuesValidator.cs @@ -6,8 +6,6 @@ using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Extensions; -#nullable enable - namespace BenchmarkDotNet.Validators { public class ParamsAllValuesValidator : IValidator diff --git a/src/BenchmarkDotNet/Validators/ReturnValueValidator.cs b/src/BenchmarkDotNet/Validators/ReturnValueValidator.cs index 75c44d04db..65d80d6c5a 100644 --- a/src/BenchmarkDotNet/Validators/ReturnValueValidator.cs +++ b/src/BenchmarkDotNet/Validators/ReturnValueValidator.cs @@ -10,8 +10,6 @@ using BenchmarkDotNet.Running; using BenchmarkDotNet.Toolchains.InProcess.NoEmit; -#nullable enable - namespace BenchmarkDotNet.Validators { public class ReturnValueValidator : ExecutionValidatorBase diff --git a/src/BenchmarkDotNet/Validators/SetupCleanupValidator.cs b/src/BenchmarkDotNet/Validators/SetupCleanupValidator.cs index 1968983922..5617251a66 100644 --- a/src/BenchmarkDotNet/Validators/SetupCleanupValidator.cs +++ b/src/BenchmarkDotNet/Validators/SetupCleanupValidator.cs @@ -4,8 +4,6 @@ using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Extensions; -#nullable enable - namespace BenchmarkDotNet.Validators { public class SetupCleanupValidator : IValidator diff --git a/src/BenchmarkDotNet/Validators/ValidationError.cs b/src/BenchmarkDotNet/Validators/ValidationError.cs index b9efad4493..0fd8c0ab76 100644 --- a/src/BenchmarkDotNet/Validators/ValidationError.cs +++ b/src/BenchmarkDotNet/Validators/ValidationError.cs @@ -2,8 +2,6 @@ using BenchmarkDotNet.Running; using JetBrains.Annotations; -#nullable enable - namespace BenchmarkDotNet.Validators { public class ValidationError : IEquatable diff --git a/src/BenchmarkDotNet/Validators/ValidationParameters.cs b/src/BenchmarkDotNet/Validators/ValidationParameters.cs index 3fed1a85a6..5d05797fc6 100644 --- a/src/BenchmarkDotNet/Validators/ValidationParameters.cs +++ b/src/BenchmarkDotNet/Validators/ValidationParameters.cs @@ -2,8 +2,6 @@ using BenchmarkDotNet.Configs; using BenchmarkDotNet.Running; -#nullable enable - namespace BenchmarkDotNet.Validators { public class ValidationParameters From 84f29cfd49e8fbf21d6af3d2975aa113fd6d24a9 Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:46:57 +0900 Subject: [PATCH 3/3] chore: remove unused nullable annotation blocks --- src/BenchmarkDotNet/Reports/Summary.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/BenchmarkDotNet/Reports/Summary.cs b/src/BenchmarkDotNet/Reports/Summary.cs index a67f8e01ca..83edb53eac 100644 --- a/src/BenchmarkDotNet/Reports/Summary.cs +++ b/src/BenchmarkDotNet/Reports/Summary.cs @@ -163,12 +163,7 @@ private static IOrderer GetConfiguredOrdererOrDefaultOne(IEnumerable benchmarkCases) => benchmarkCases - .Where(benchmark => benchmark.Config.SummaryStyle != SummaryStyle.Default -#nullable disable - // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract ConditionIsAlwaysTrueOrFalse - // TODO: remove this check once the nullability migration is finished - && benchmark.Config.SummaryStyle != null) // Paranoid -#nullable enable + .Where(benchmark => benchmark.Config.SummaryStyle != SummaryStyle.Default) .Select(benchmark => benchmark.Config.SummaryStyle) .Distinct() .FirstOrDefault()