BenchmarkDotNet: Cannot benchmark netcoreapp3.0

I got this error when trying to run a benchmark on CoreRuntime.Core30. Should BDN try to fix this and keep supporting older build targets, or just drop support?

// Build Error: Standard output:

 Standard error:
 MSBuild version 17.7.0-preview-23281-03+4ce2ff1f8 for .NET
C:\Users\Tim\.nuget\packages\system.runtime.compilerservices.unsafe\6.0.0\buildTransitive\netcoreapp2.0\System.Runtime.CompilerServices.Unsafe.targets(4,5): error : System.Runtime.CompilerServices.Unsafe doesn't support netcoreapp3.0. Consider updating your TargetFramework to netcoreapp3.1 or later. [C:\Users\Tim\Documents\git\ProtoPromiseBenchmarks\AsynchronousBenchmarks\bin\Release\net472\c449f68f-17cc-4372-a6f3-e6f7e2ae26c3\BenchmarkDotNet.Autogenerated.csproj]
Build FAILED.
C:\Users\Tim\.nuget\packages\system.runtime.compilerservices.unsafe\6.0.0\buildTransitive\netcoreapp2.0\System.Runtime.CompilerServices.Unsafe.targets(4,5): error : System.Runtime.CompilerServices.Unsafe doesn't support netcoreapp3.0. Consider updating your TargetFramework to netcoreapp3.1 or later. [C:\Users\Tim\Documents\git\ProtoPromiseBenchmarks\AsynchronousBenchmarks\bin\Release\net472\c449f68f-17cc-4372-a6f3-e6f7e2ae26c3\BenchmarkDotNet.Autogenerated.csproj]
    0 Warning(s)
    1 Error(s)
Time Elapsed 00:00:00.64

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

While the package supports netstandard2.0, it explicitly lists the .NETCoreApp TFMs that are supported: netcoreapp3.1, net5.0 and net6.0.

I find it confusing, I would expect it to simply support only netcoreapp3.1, net5.0 and net6.0 in explicit way.

Just curious, why does BDN target .NET Standard?

We support all runtimes and architectures and wanted to reduce the number of #if defs and targeted TFMs.

Conditionally use net5 nuget packages for netstandard2.0 target and net6 packages for net6.0 target

I believe this is the way to go.

If someone really must stay on an unsupported runtime (for whatever reason), they can do so an also stay on a previous released version of BenchmarkDotNet.

That is true, but on the other hand once in a while I need to find a version of .NET Core where perf change was introduced and I benchmark all of them. Once I find the version I user the profiler and disassembler plugins to understand what exactly has changed. These plugins are improving over time and work fine with older runtimes.

Others often benchmark current vs old .NET version to show how it has changed over time. If they use an old BDN version it may not support current .NET version.

So we are definitely going to keep .NET Standard 2.0 support for years to come. And live with the pain it causes to us 😉

While the package supports netstandard2.0, it explicitly lists the .NETCoreApp TFMs that are supported: netcoreapp3.1, net5.0 and net6.0.

Please see https://github.com/open-telemetry/opentelemetry-dotnet/issues/3448 which has much more information on that subject.

Only below 3.1. Typically, we try to support all the old runtimes while it doesn’t require additional maintenance efforts.