dotnet / BenchmarkDotNet

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

Cannot build Native AOT 8.0 on all platforms #2593

Open swtrse opened 1 month ago

swtrse commented 1 month ago

This is in terms of the issue a copy of https://github.com/dotnet/BenchmarkDotNet/issues/2548.

However, since I run into this problem on windows, Linux and mac and based on my code review this would be a problem for all platforms. Since all platforms are affected, I created this issue because it should be taken care of with higher priority.

swtrse commented 1 month ago

AOT 9.0 do also fail with the same reason

swtrse commented 3 weeks ago

As a workaround. Since the Attribute is not working but if you put that logic into a customConfig it will work. Just for example

public IEnumerable<Job> GetJobs()
{
    Runtime[] runtimes = [CoreRuntime.Core80, CoreRuntime.Core90, NativeAotRuntime.Net80, NativeAotRuntime.Net90];
    foreach (var runtime in runtimes)
    {
        //var sourceJob = Job.LongRun;
        var sourceJob = Job.ShortRun;
        var baseJob = sourceJob.WithRuntime(runtime).WithId($"{sourceJob.Id}-{runtime.Name}").WithToolchain(new InProcessEmitToolchain(TimeSpan.FromHours(24D), true));
        yield return baseJob;
    }
}