Skip to content

Commit

Permalink
Fix DotTrace/DotMemory attribute ctors, fix #2554
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyAkinshin committed Apr 8, 2024
1 parent 55ce92d commit a24d689
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
11 changes: 1 addition & 10 deletions src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,10 @@

namespace BenchmarkDotNet.Diagnostics.dotMemory
{
public class DotMemoryDiagnoser : IProfiler
public class DotMemoryDiagnoser(Uri? nugetUrl = null, string? toolsDownloadFolder = null) : IProfiler
{
private readonly Uri? nugetUrl;
private readonly string? toolsDownloadFolder;

private DotMemoryTool? tool;

public DotMemoryDiagnoser(Uri? nugetUrl = null, string? toolsDownloadFolder = null)
{
this.nugetUrl = nugetUrl;
this.toolsDownloadFolder = toolsDownloadFolder;
}

public IEnumerable<string> Ids => new[] { "DotMemory" };
public string ShortName => "dotMemory";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ public DotMemoryDiagnoserAttribute()
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotMemoryDiagnoser());
}

public DotMemoryDiagnoserAttribute(Uri? nugetUrl = null, string? toolsDownloadFolder = null)
public DotMemoryDiagnoserAttribute(string? nugetUrl = null, string? toolsDownloadFolder = null)
{
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotMemoryDiagnoser(nugetUrl, toolsDownloadFolder));
var nugetUri = nugetUrl == null ? null : new Uri(nugetUrl);
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotMemoryDiagnoser(nugetUri, toolsDownloadFolder));
}
}
}
11 changes: 1 addition & 10 deletions src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,8 @@

namespace BenchmarkDotNet.Diagnostics.dotTrace
{
public class DotTraceDiagnoser : IProfiler
public class DotTraceDiagnoser(Uri? nugetUrl = null, string? toolsDownloadFolder = null) : IProfiler
{
private readonly Uri? nugetUrl;
private readonly string? toolsDownloadFolder;

public DotTraceDiagnoser(Uri? nugetUrl = null, string? toolsDownloadFolder = null)
{
this.nugetUrl = nugetUrl;
this.toolsDownloadFolder = toolsDownloadFolder;
}

public IEnumerable<string> Ids => new[] { "DotTrace" };
public string ShortName => "dotTrace";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ public DotTraceDiagnoserAttribute()
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotTraceDiagnoser());
}

public DotTraceDiagnoserAttribute(Uri? nugetUrl = null, string? toolsDownloadFolder = null)
public DotTraceDiagnoserAttribute(string? nugetUrl = null, string? toolsDownloadFolder = null)
{
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotTraceDiagnoser(nugetUrl, toolsDownloadFolder));
var nugetUri = nugetUrl == null ? null : new Uri(nugetUrl);
Config = ManualConfig.CreateEmpty().AddDiagnoser(new DotTraceDiagnoser(nugetUri, toolsDownloadFolder));
}
}
}

0 comments on commit a24d689

Please sign in to comment.