Nbench: 指定されたフレームワークバージョン「2.1」を解析できませんでした

作成日 2018年10月15日  ·  7コメント  ·  ソース: petabridge/NBench

dotnet nbenchは以下のログで失敗しました。

❯ dotnet nbench
Building for framework netcoreapp2.1...
  Benchmark.SimepleOneway.Local -> /SolutionDir/ProjectDir/bin/Release/netcoreapp2.1/Benchmark.SimepleOneway.Local.dll
Running .NET Core 2.1 tests for framework netcoreapp2.1...
OutputDir /SolutionDir/ProjectDir/PerfResults
The specified framework version '2.1' could not be parsed
The specified framework 'Microsoft.NETCore.App', version '2.1' was not found.
  - Check application dependencies and target a framework version installed at:
      /usr/local/share/dotnet/
  - Installing .NET Core prerequisites might help resolve this problem:
      http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
  - The .NET Core framework and SDK can be installed from:
      https://aka.ms/dotnet-download
  - The following versions are installed:
      2.0.9 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
      2.1.3 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
      2.1.5 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
bug benchmark-execution

全てのコメント7件

@HIPERCUBEこれは環境の問題である可能性がありますが、再確認させてください。

プロジェクトにランタイムバージョンを指定するglobal.jsonまたは何かがありますか?

dotnet core2.1でNBenchを実行する際の問題を確認できます

The specified framework version '2.1' could not be parsed
The specified framework 'Microsoft.NETCore.App', version '2.1' was not found.
  - Check application dependencies and target a framework version installed at:
      C:\Program Files\dotnet\
  - Installing .NET Core prerequisites might help resolve this problem:
      http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
  - The .NET Core framework and SDK can be installed from:
      https://aka.ms/dotnet-download
  - The following versions are installed:
      2.0.6 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.0.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.1.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.1.2 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.1.3-servicing-26724-03 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.1.4 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.1.5 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

gloabl.jsonファイルがなく、他の2.1プロジェクトは正常に実行されています。 また、バージョンの不一致があるかどうかを再確認するために2.1ラン​​タイムをインストールしましたが、それでも機能しません。

何か助けがあれば、.csprojに<RuntimeFrameworkVersion>2.1.5</RuntimeFrameworkVersion>を追加すると、問題が修正されたことがわかりました(クレジットは、ここにリストされている解決策について@ Rene-Sackersに送られます:https://github.com/dotnet/cli/issues/ 10111#issuecomment-429014700)。

これは、私が知る限り、 dotnet CLIの問題のようです。リンクされている問題などをいくつか調べてみてください。 ここに書かれているエラーはNBenchからのものではなく、 dotnet-nbenchがテストランナーを実行するために生成するdotnetプロセスからのものです。

問題の根本的な原因は、ASP.NET CoreからインポートしたこのDotNetMuxerクラスを使用して、 dotnetプロセスを呼び出す方法である可能性があると感じています。

https://github.com/petabridge/NBench/blob/557f2fbca250a4a45636f5e4b41b58b8440b33f2/src/NBench.Runner.DotNetCli/DotNetMuxer.cs#L1 -L74

複製プロジェクトを作成しました: https

そこにあるサンプルプロジェクトでdotnet buildを呼び出してから、 dotnet nbenchを呼び出すと、次の出力が得られます。

λ  dotnet nbench
Building for framework netcoreapp2.1...
  NBenchRepro -> C:\Repositories\NBenchNetCore2.1Repro\NBenchRepro\bin\Release\netcoreapp2.1\NBenchRepro.dll
Running .NET Core 2.1.0 tests for framework netcoreapp2.1...
OutputDir C:\Repositories\NBenchNetCore2.1Repro\NBenchRepro\PerfResults
Executing Benchmarks in C:\Repositories\NBenchNetCore2.1Repro\NBenchRepro\bin\Release\netcoreapp2.1\NBenchRepro.dll
------------ STARTING NBenchRepro.CounterPerfSpecs+Benchmark ----------
--------------- BEGIN WARMUP ---------------
Elapsed: 00:00:00.1657419
[Counter] TestCounter - operations: 25,439,744.00 ,operations: /s 153,490,119.28 , ns / operations: 6.52
--------------- END WARMUP ---------------

--------------- BEGIN WARMUP ---------------
Elapsed: 00:00:00.1663968
[Counter] TestCounter - operations: 25,439,744.00 ,operations: /s 152,886,017.04 , ns / operations: 6.54
--------------- END WARMUP ---------------

--------------- BEGIN WARMUP ---------------
Elapsed: 00:00:00.1670527
[Counter] TestCounter - operations: 25,439,744.00 ,operations: /s 152,285,739.77 , ns / operations: 6.57
--------------- END WARMUP ---------------

--------------- BEGIN RUN ---------------
Elapsed: 00:00:00.1659459
[Counter] TestCounter - operations: 25,439,744.00 ,operations: /s 153,301,431.37 , ns / operations: 6.52
--------------- END RUN ---------------

--------------- BEGIN RUN ---------------
Elapsed: 00:00:00.1654938
[Counter] TestCounter - operations: 25,439,744.00 ,operations: /s 153,720,223.96 , ns / operations: 6.51
--------------- END RUN ---------------

--------------- BEGIN RUN ---------------
Elapsed: 00:00:00.1651669
[Counter] TestCounter - operations: 25,439,744.00 ,operations: /s 154,024,468.58 , ns / operations: 6.49
--------------- END RUN ---------------

--------------- RESULTS: NBenchRepro.CounterPerfSpecs+Benchmark ---------------
Test to ensure that a minimal throughput test can be rapidly executed.
--------------- DATA ---------------
[Counter] TestCounter: Max: 25,439,744.00 operations, Average: 25,439,744.00 operations, Min: 25,439,744.00 operations, StdDev: 0.00 operations
[Counter] TestCounter: Max / s: 154,024,468.58 operations, Average / s: 153,682,041.30 operations, Min / s: 153,301,431.37 operations, StdDev / s: 363,027.74 operations

--------------- ASSERTIONS ---------------
[PASS] Expected [Counter] TestCounter to must be greater than 10,000,000.00 operations; actual value was 153,682,041.30 operations.

------------ FINISHED NBenchRepro.CounterPerfSpecs+Benchmark ----------

この場合、NBench1.2.2とdotnet --version 2.1.300を使用します。

したがって、これは環境問題に非常によく似ています。これは、過去にdotnet xunitで同様の問題が発生した場合によくあることです。 ご使用の環境がどのように見えるか、または複製の仕様についてさらに情報を提供していただければ、この問題を再度開いて、少しずつ取り上げていきます。

それまでの間、@ C-Babbageの提案に従って明示的なランタイムバージョンを指定することで回避策を試すことができます。

このいくつかのフォローアップ-https://github.com/petabridge/Petabridge.Tracing.Zipkin/pull/68で作業しているときに、この問題を自分で再現することができました

Entity FrameworkおよびXUnitチームと同じ結論に達しました。これはCLI自体の問題であり、回避策はテストプロジェクト内でRuntimeFrameworkVersion指定しているようです。 これにより、CLIは.NETCoreランタイムを正しく解決するために必要な情報を得ることができます。

将来的にはこれが改善されることを願っていますが、このエラーは、 dotnet-nbenchが新しいdotnetプロセスを起動して仕様を実行した後に発生します。これはCLIの問題です。

このページは役に立ちましたか?
0 / 5 - 0 評価