Skip to content

Commit a24d689

Browse files
Fix DotTrace/DotMemory attribute ctors, fix #2554
1 parent 55ce92d commit a24d689

File tree

4 files changed

+8
-24
lines changed

4 files changed

+8
-24
lines changed

src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs

+1-10
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,10 @@
1616

1717
namespace BenchmarkDotNet.Diagnostics.dotMemory
1818
{
19-
public class DotMemoryDiagnoser : IProfiler
19+
public class DotMemoryDiagnoser(Uri? nugetUrl = null, string? toolsDownloadFolder = null) : IProfiler
2020
{
21-
private readonly Uri? nugetUrl;
22-
private readonly string? toolsDownloadFolder;
23-
2421
private DotMemoryTool? tool;
2522

26-
public DotMemoryDiagnoser(Uri? nugetUrl = null, string? toolsDownloadFolder = null)
27-
{
28-
this.nugetUrl = nugetUrl;
29-
this.toolsDownloadFolder = toolsDownloadFolder;
30-
}
31-
3223
public IEnumerable<string> Ids => new[] { "DotMemory" };
3324
public string ShortName => "dotMemory";
3425

src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoserAttribute.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ public DotMemoryDiagnoserAttribute()
1313
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotMemoryDiagnoser());
1414
}
1515

16-
public DotMemoryDiagnoserAttribute(Uri? nugetUrl = null, string? toolsDownloadFolder = null)
16+
public DotMemoryDiagnoserAttribute(string? nugetUrl = null, string? toolsDownloadFolder = null)
1717
{
18-
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotMemoryDiagnoser(nugetUrl, toolsDownloadFolder));
18+
var nugetUri = nugetUrl == null ? null : new Uri(nugetUrl);
19+
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotMemoryDiagnoser(nugetUri, toolsDownloadFolder));
1920
}
2021
}
2122
}

src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs

+1-10
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,8 @@
1717

1818
namespace BenchmarkDotNet.Diagnostics.dotTrace
1919
{
20-
public class DotTraceDiagnoser : IProfiler
20+
public class DotTraceDiagnoser(Uri? nugetUrl = null, string? toolsDownloadFolder = null) : IProfiler
2121
{
22-
private readonly Uri? nugetUrl;
23-
private readonly string? toolsDownloadFolder;
24-
25-
public DotTraceDiagnoser(Uri? nugetUrl = null, string? toolsDownloadFolder = null)
26-
{
27-
this.nugetUrl = nugetUrl;
28-
this.toolsDownloadFolder = toolsDownloadFolder;
29-
}
30-
3122
public IEnumerable<string> Ids => new[] { "DotTrace" };
3223
public string ShortName => "dotTrace";
3324

src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoserAttribute.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ public DotTraceDiagnoserAttribute()
1313
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotTraceDiagnoser());
1414
}
1515

16-
public DotTraceDiagnoserAttribute(Uri? nugetUrl = null, string? toolsDownloadFolder = null)
16+
public DotTraceDiagnoserAttribute(string? nugetUrl = null, string? toolsDownloadFolder = null)
1717
{
18-
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotTraceDiagnoser(nugetUrl, toolsDownloadFolder));
18+
var nugetUri = nugetUrl == null ? null : new Uri(nugetUrl);
19+
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotTraceDiagnoser(nugetUri, toolsDownloadFolder));
1920
}
2021
}
2122
}

0 commit comments

Comments
 (0)