Skip to content

Fix benchmarks for netcoreapp5.0#3014

Merged
YohDeadfall merged 2 commits intonpgsql:devfrom
chrisdcmoore:fix/benchmarks-netcoreapp5.0
Jun 13, 2020
Merged

Fix benchmarks for netcoreapp5.0#3014
YohDeadfall merged 2 commits intonpgsql:devfrom
chrisdcmoore:fix/benchmarks-netcoreapp5.0

Conversation

@chrisdcmoore
Copy link
Contributor

When trying to run the benchmarks with Microsoft.NETCore.App 5.0.0-preview.5.20278.1, they would fail with the following stacktrace

Unhandled exception. System.NotSupportedException: Unknown .NET Framework
   at BenchmarkDotNet.Portability.RuntimeInformation.GetCurrentRuntime()
   at BenchmarkDotNet.Characteristics.Resolver.<>c__DisplayClass1_0`1.<Register>b__0(CharacteristicObject obj)
   at BenchmarkDotNet.Characteristics.Resolver.Resolve[T](CharacteristicObject obj, Characteristic`1 characteristic)
   at BenchmarkDotNet.Characteristics.CompositeResolver.Resolve[T](CharacteristicObject obj, Characteristic`1 characteristic)
   at BenchmarkDotNet.Characteristics.CharacteristicObject.ResolveValue[T](Characteristic`1 characteristic, IResolver resolver)
   at BenchmarkDotNet.Toolchains.ToolchainExtensions.GetToolchain(Job job)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.<>c__DisplayClass12_0.<GetSupportedBenchmarks>b__2(BenchmarkCase benchmark)
   at System.Linq.Enumerable.WhereArrayIterator`1.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.<>c__DisplayClass12_0.<GetSupportedBenchmarks>b__0(BenchmarkRunInfo info)
   at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.GetSupportedBenchmarks(BenchmarkRunInfo[] benchmarkRunInfos, ILogger logger, IResolver resolver)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.Run(BenchmarkRunInfo[] benchmarkRunInfos)
   at BenchmarkDotNet.Running.BenchmarkSwitcher.RunWithDirtyAssemblyResolveHelper(String[] args, IConfig config)
   at BenchmarkDotNet.Running.BenchmarkSwitcher.Run(String[] args, IConfig config)
   at Npgsql.Benchmarks.Program.Main(String[] args) in C:\Users\Chris\src\npgsql\test\Npgsql.Benchmarks\Program.cs:line 8

This is due to the verison of BenchmarkDotNet being used not supporting the .NET Core 5 -> .NET 5 rebrand (see dotnet/BenchmarkDotNet#1399)

This PR:

  • bumps BenchmarkDotNet to the latest stable version at time of writing (0.12.1) which includes support for runtime detection post-rebrand
  • fixes up the build post-package-upgrade by replacing usages of now-obsolete methods with their new equivalents

The benchmarks can now be run on post-rebrand .NET 5 runtimes.

@chrisdcmoore chrisdcmoore force-pushed the fix/benchmarks-netcoreapp5.0 branch from 0fd8631 to 241a4db Compare June 13, 2020 12:40
@YohDeadfall YohDeadfall added this to the 5.0 milestone Jun 13, 2020
@YohDeadfall YohDeadfall merged commit d94c2a0 into npgsql:dev Jun 13, 2020
@YohDeadfall
Copy link
Contributor

Thank you!

@chrisdcmoore chrisdcmoore deleted the fix/benchmarks-netcoreapp5.0 branch June 13, 2020 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants