dotnet / BenchmarkDotNet

Powerful .NET library for benchmarking
https://benchmarkdotnet.org
MIT License
10.24k stars 952 forks source link

Question about visibility of DotTraceDiagnoser's second constructor #2554

Closed ricsiLT closed 3 months ago

ricsiLT commented 3 months ago

Hi,

Not sure how to formulate the question, but I was trying to attach the following attribute to benchmark class:

[DotTraceDiagnoser]
public class SqliteDbReadBenchmark

This defaults to default nuget portal and that is firewalled away for me. DotTraceDiagnoser has a secondary constructor that takes Uri as first arg - that would work, but this is invalid C#:

[DotTraceDiagnoser(new Uri(""))]
public class SqliteDbReadBenchmark

Shouldn't this constructor be hidden? Or DotTraceDiagnoserAttribute updated to not take in Uri? Or is that just mandatory when creating Attribute?

gassanosh commented 3 months ago

Probably the type of the parameter could be changed to string. In that case it will possible to specify the url of nuget mirror: https://github.com/JetBrains/profiler-self-api/issues/14#issuecomment-2041589316

AndreyAkinshin commented 3 months ago

@ricsiLT, thanks for the report! @gassanosh, I like your suggestion about string arguments. Implemented in https://github.com/dotnet/BenchmarkDotNet/commit/a24d689361c44356b12892424d25bdf27d13d8da