Skip to content

InProcessNoEmitToolchain + NativeAOT Support? #2701

Closed
@eliphatfs

Description

@eliphatfs

I have the same use cases as #2694 to benchmark the same binary on different machines.

I use this config object:

    public class BenchmarkConfig : ManualConfig
    {
        public BenchmarkConfig()
        {
            AddJob(Job.Default.WithToolchain(InProcessNoEmitToolchain.Instance));
        }
    }

However, when running a published NativeAOT (.NET 9.0.2) executable, I get:

System.InvalidOperationException: Bug: type BenchmarkDotNet.Toolchains.InProcess.NoEmit.InProcessNoEmitRunner+Runnable not found.
   at BenchmarkDotNet.Toolchains.InProcess.NoEmit.InProcessNoEmitRunner.Run(IHost, BenchmarkCase) + 0x370
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at BenchmarkDotNet.Toolchains.Results.ExecuteResult.LogIssues(ILogger, BuildResult) + 0x1f
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.RunExecute(ILogger, BenchmarkCase, BenchmarkId, IToolchain, BuildResult, IResolver, IDiagnoser, Int32) + 0xeb
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.Execute(ILogger, BenchmarkCase, BenchmarkId, IToolchain, BuildResult, IResolver) + 0x572
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.RunCore(BenchmarkCase, BenchmarkId, ILogger, IResolver, BuildResult) + 0xa3
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.Run(BenchmarkRunInfo, Dictionary`2, IResolver, ILogger, EventProcessor, List`1, String, String, Int32, StartedClock&, Int32&, TaskbarProgress) + 0x7f6
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.Run(BenchmarkRunInfo[]) + 0x982
   at BenchmarkDotNet.Running.BenchmarkRunner.RunWithDirtyAssemblyResolveHelper(Type, IConfig, String[]) + 0x50
   at BenchmarkDotNet.Running.BenchmarkRunner.RunWithExceptionHandling(Func`1) + 0x20
   at BenchmarkDotNet.Running.BenchmarkRunner.Run[T](IConfig, String[]) + 0x77

I see BenchmarkDotNet.Toolchains.InProcess.NoEmit.InProcessNoEmitRunner+Runnable is a private class https://github.com/dotnet/BenchmarkDotNet/blob/master/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/InProcessNoEmitRunner.cs so I can't
use DynamicDependencyAttribute to keep the class from being trimmed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions