Benchmarkdotnet: Please help running a mono job with errors on windows 10

Created on 7 Mar 2019  路  7Comments  路  Source: dotnet/BenchmarkDotNet

I get this error:

image

what am I supposed to do?

Most helpful comment

Your project needs to target multiple frameworks:

<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>

but to run Mono and .NET Core benchmarks you need to run the host process as Full .NET Framework

example:

dotnet run -c Release -f net461 --filter * --runtimes mono netcoreapp2.0 net461

to make sure that the console line arguments are handled you need to pass them to BenchmarkSwitcher:

class Program
{
    static void Main(string[] args)
        => BenchmarkSwitcher
            .FromAssembly(typeof(Program).Assembly)
            .Run(args, DefaultConfig.Instance);
}

All 7 comments

Hi @sebas77

Is your project targeting .NET Core or Full .NET Framework?

Out Mono Toolchain works if you run the host process as Full .NET Framework (not Core)

ah! I suspected that, but for some reason stupid VS doesn't like me changing the target and force me to revert to core. I will figure it out, thanks ;)

it worked, but now I cannot run the core jobs, does it mean I have to have multiple projects targeting multiple frameworks to profile it?

Your project needs to target multiple frameworks:

<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>

but to run Mono and .NET Core benchmarks you need to run the host process as Full .NET Framework

example:

dotnet run -c Release -f net461 --filter * --runtimes mono netcoreapp2.0 net461

to make sure that the console line arguments are handled you need to pass them to BenchmarkSwitcher:

class Program
{
    static void Main(string[] args)
        => BenchmarkSwitcher
            .FromAssembly(typeof(Program).Assembly)
            .Run(args, DefaultConfig.Instance);
}

hmmm maybe it's simpler to have different projects :P

ok so eventually I did this and it was very simple, but there is still something wrong:

StandardPinnedArrayInsert | Core | Default | NA | NA | NA | ? | ? | | StandardListInsert | Core | Default | NA | NA | NA | ? | ? | | StandardManagedSpanInsert | Core | Default | NA | NA | NA | ? | ? | | StandardUnmanagedSpanInsert | Core | Default | NA | NA | NA | ? | ? | | StandardUnmanagedSpanBenInsert | Core | Default | NA | NA | NA | ? | ? | | StandardArrayInsert | Core | netcoreapp3.0 | 4.671 ms | NA | 0.1196 ms | 0.77 | 0.02 | | StandardUnmanagedArrayInsert | Core | netcoreapp3.0 | 4.491 ms | NA | 0.0418 ms | 0.74 | 0.01 | | StandardPinnedArrayInsert | Core | netcoreapp3.0 | 4.354 ms | NA | 0.0468 ms | 0.72 | 0.01 | | StandardListInsert | Core | netcoreapp3.0 | 15.993 ms | NA | 0.0884 ms | 2.64 | 0.01 | | StandardManagedSpanInsert | Core | netcoreapp3.0 | 5.056 ms | NA | 0.1267 ms | 0.83 | 0.02 |

what is teh Core Default and why is there?

oh, OK I guess I have to remove the compiler attribute from the class

Was this page helpful?
0 / 5 - 0 ratings