diff --git a/src/BenchmarkDotNet.Diagnostics.dotTrace/BenchmarkDotNet.Diagnostics.dotTrace.csproj b/src/BenchmarkDotNet.Diagnostics.dotTrace/BenchmarkDotNet.Diagnostics.dotTrace.csproj
index e4037e5bcf..e7852f1575 100644
--- a/src/BenchmarkDotNet.Diagnostics.dotTrace/BenchmarkDotNet.Diagnostics.dotTrace.csproj
+++ b/src/BenchmarkDotNet.Diagnostics.dotTrace/BenchmarkDotNet.Diagnostics.dotTrace.csproj
@@ -6,6 +6,7 @@
BenchmarkDotNet.Diagnostics.dotTrace
BenchmarkDotNet.Diagnostics.dotTrace
BenchmarkDotNet.Diagnostics.dotTrace
+ enable
diff --git a/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs b/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs
index a53c305938..1b3186124b 100644
--- a/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs
+++ b/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs
@@ -19,10 +19,10 @@ namespace BenchmarkDotNet.Diagnostics.dotTrace
{
public class DotTraceDiagnoser : IProfiler
{
- private readonly Uri nugetUrl;
- private readonly string toolsDownloadFolder;
+ private readonly Uri? nugetUrl;
+ private readonly string? toolsDownloadFolder;
- public DotTraceDiagnoser(Uri nugetUrl = null, string toolsDownloadFolder = null)
+ public DotTraceDiagnoser(Uri? nugetUrl = null, string? toolsDownloadFolder = null)
{
this.nugetUrl = nugetUrl;
this.toolsDownloadFolder = toolsDownloadFolder;
diff --git a/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoserAttribute.cs b/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoserAttribute.cs
index de803e6443..19e88a6de1 100644
--- a/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoserAttribute.cs
+++ b/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoserAttribute.cs
@@ -13,7 +13,7 @@ public DotTraceDiagnoserAttribute()
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotTraceDiagnoser());
}
- public DotTraceDiagnoserAttribute(Uri nugetUrl = null, string toolsDownloadFolder = null)
+ public DotTraceDiagnoserAttribute(Uri? nugetUrl = null, string? toolsDownloadFolder = null)
{
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotTraceDiagnoser(nugetUrl, toolsDownloadFolder));
}
diff --git a/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceToolBase.cs b/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceToolBase.cs
index c41ffc53e5..f2f07625fa 100644
--- a/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceToolBase.cs
+++ b/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceToolBase.cs
@@ -11,11 +11,11 @@ namespace BenchmarkDotNet.Diagnostics.dotTrace
internal abstract class DotTraceToolBase
{
private readonly ILogger logger;
- private readonly Uri nugetUrl;
+ private readonly Uri? nugetUrl;
private readonly NuGetApi nugetApi;
- private readonly string downloadTo;
+ private readonly string? downloadTo;
- protected DotTraceToolBase(ILogger logger, Uri nugetUrl = null, NuGetApi nugetApi = NuGetApi.V3, string downloadTo = null)
+ protected DotTraceToolBase(ILogger logger, Uri? nugetUrl = null, NuGetApi nugetApi = NuGetApi.V3, string? downloadTo = null)
{
this.logger = logger;
this.nugetUrl = nugetUrl;
@@ -48,9 +48,9 @@ public void Init(DiagnoserActionParameters parameters)
public string Start(DiagnoserActionParameters parameters)
{
string snapshotFile = ArtifactFileNameHelper.GetFilePath(parameters, "snapshots", DateTime.Now, "dtp", ".0000".Length);
- string snapshotDirectory = Path.GetDirectoryName(snapshotFile);
+ string? snapshotDirectory = Path.GetDirectoryName(snapshotFile);
logger.WriteLineInfo($"Target snapshot file: {snapshotFile}");
- if (!Directory.Exists(snapshotDirectory))
+ if (!Directory.Exists(snapshotDirectory) && snapshotDirectory != null)
{
try
{
@@ -126,7 +126,7 @@ protected string GetRunnerPath()
if (consoleRunnerPackageField == null)
throw new InvalidOperationException("Field 'ConsoleRunnerPackage' not found.");
- object consoleRunnerPackage = consoleRunnerPackageField.GetValue(null);
+ object? consoleRunnerPackage = consoleRunnerPackageField.GetValue(null);
if (consoleRunnerPackage == null)
throw new InvalidOperationException("Unable to get value of 'ConsoleRunnerPackage'.");
@@ -135,7 +135,7 @@ protected string GetRunnerPath()
if (getRunnerPathMethod == null)
throw new InvalidOperationException("Method 'GetRunnerPath' not found.");
- string runnerPath = getRunnerPathMethod.Invoke(consoleRunnerPackage, null) as string;
+ string? runnerPath = getRunnerPathMethod.Invoke(consoleRunnerPackage, null) as string;
if (runnerPath == null)
throw new InvalidOperationException("Unable to invoke 'GetRunnerPath'.");
diff --git a/src/BenchmarkDotNet.Diagnostics.dotTrace/ExternalDotTraceTool.cs b/src/BenchmarkDotNet.Diagnostics.dotTrace/ExternalDotTraceTool.cs
index 9c5161b309..dfc9903b82 100644
--- a/src/BenchmarkDotNet.Diagnostics.dotTrace/ExternalDotTraceTool.cs
+++ b/src/BenchmarkDotNet.Diagnostics.dotTrace/ExternalDotTraceTool.cs
@@ -12,7 +12,7 @@ internal class ExternalDotTraceTool : DotTraceToolBase
{
private static readonly TimeSpan AttachTimeout = TimeSpan.FromMinutes(5);
- public ExternalDotTraceTool(ILogger logger, Uri nugetUrl = null, NuGetApi nugetApi = NuGetApi.V3, string downloadTo = null) :
+ public ExternalDotTraceTool(ILogger logger, Uri? nugetUrl = null, NuGetApi nugetApi = NuGetApi.V3, string? downloadTo = null) :
base(logger, nugetUrl, nugetApi, downloadTo) { }
protected override bool AttachOnly => true;
@@ -44,7 +44,7 @@ protected override void Attach(DiagnoserActionParameters parameters, string snap
{
process.OutputDataReceived += (_, args) =>
{
- string content = args.Data;
+ string? content = args.Data;
if (content != null)
{
logger.WriteLineInfo("[dotTrace] " + content);
@@ -54,7 +54,7 @@ protected override void Attach(DiagnoserActionParameters parameters, string snap
};
process.ErrorDataReceived += (_, args) =>
{
- string content = args.Data;
+ string? content = args.Data;
if (content != null)
logger.WriteLineError("[dotTrace] " + args.Data);
};
diff --git a/src/BenchmarkDotNet.Diagnostics.dotTrace/InProcessDotTraceTool.cs b/src/BenchmarkDotNet.Diagnostics.dotTrace/InProcessDotTraceTool.cs
index a124e3e495..a02c9c1995 100644
--- a/src/BenchmarkDotNet.Diagnostics.dotTrace/InProcessDotTraceTool.cs
+++ b/src/BenchmarkDotNet.Diagnostics.dotTrace/InProcessDotTraceTool.cs
@@ -7,7 +7,7 @@ namespace BenchmarkDotNet.Diagnostics.dotTrace
{
internal class InProcessDotTraceTool : DotTraceToolBase
{
- public InProcessDotTraceTool(ILogger logger, Uri nugetUrl = null, NuGetApi nugetApi = NuGetApi.V3, string downloadTo = null) :
+ public InProcessDotTraceTool(ILogger logger, Uri? nugetUrl = null, NuGetApi nugetApi = NuGetApi.V3, string? downloadTo = null) :
base(logger, nugetUrl, nugetApi, downloadTo) { }
protected override bool AttachOnly => false;
diff --git a/src/BenchmarkDotNet.Diagnostics.dotTrace/Progress.cs b/src/BenchmarkDotNet.Diagnostics.dotTrace/Progress.cs
index 1d8249f31e..c353939f1f 100644
--- a/src/BenchmarkDotNet.Diagnostics.dotTrace/Progress.cs
+++ b/src/BenchmarkDotNet.Diagnostics.dotTrace/Progress.cs
@@ -18,7 +18,7 @@ public Progress(ILogger logger, string title)
}
private int lastProgress;
- private Stopwatch stopwatch;
+ private Stopwatch? stopwatch;
public void Report(double value)
{