dotnet / BenchmarkDotNet

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

HideColumns + custom corerun = incorrect table markdown #2545

Closed EgorBo closed 2 months ago

EgorBo commented 4 months ago

Minimal repro:

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);

[HideColumns("Job", "StdDev", "RatioSD")]
public class MyBench
{
    [Benchmark]
    public bool Test() => true;
}

If I run this benchmark with a custom corerun, e.g.:

dotnet run -c Release -- --filter "*" --coreRun Path\to\corerun.exe

it outputs this:

| Method | Mean      | Error     |
|------- |----------:|----------:|-
| Test   | 0.0062 ns | 0.0042 ns |

that trailing |- on the 2nd row makes the whole markdown invalid, e.g. here is what happens if I paste it here:

Method Mean Error
Test 0.0062 ns 0.0042 ns

While it should be:

Method Mean Error
Test 0.0062 ns 0.0042 ns

I can try to fix it myself unless you know that it can be trivially fixed 🙂

adamsitnik commented 4 months ago

cc @YegorStepanov who contributed this feature in #1890

timcassell commented 4 months ago

Possibly introduced in #2410. cc @Vahdanian