BenchmarkDotNet directly throws The handle is invalid exception
Hi,
When trying to run LINQPad Tutorial & Reference/Benchmarking Your Code/Benchmarking - direct.linq
I'm getting "The handle is invalid "exception.
I'm using LINQPad 7 v7.5.16 X64
Any idea how to fix this?
// Validating benchmarks:
// * Assembly LINQPadQuery, Version=1.0.0.14, Culture=neutral, PublicKeyToken=null is located in temp. If you are running benchmarks from xUnit you need to disable shadow copy. It's not supported by design.
TargetSite TargetSite
Message The handle is invalid.
Data Data
InnerException null
HelpLink null
Source System.Console
HResult -2147024890
StackTrace at System.ConsolePal.get_Title()
at BenchmarkDotNet.Running.BenchmarkRunnerClean.Run(BenchmarkRunInfo benchmarkRunInfo, Dictionary2 buildResults, IResolver resolver, ILogger logger, List
1 artifactsToCleanup, String resultsFolderPath, String logFilePath, Int32 totalBenchmarkCount, StartedClock& runsChronometer, Int32& benchmarksToRunCount, TaskbarProgress taskbarProgress)
at BenchmarkDotNet.Running.BenchmarkRunnerClean.Run(BenchmarkRunInfo[] benchmarkRunInfos)
at BenchmarkDotNet.Running.BenchmarkRunner.RunWithDirtyAssemblyResolveHelper(Type type, IConfig config, String[] args)
at BenchmarkDotNet.Running.BenchmarkRunner.<>c__DisplayClass0_01.<Run>b__0() at BenchmarkDotNet.Running.BenchmarkRunner.RunWithExceptionHandling(Func
1 run)
at BenchmarkDotNet.Running.BenchmarkRunner.Run[T](IConfig config, String[] args)
at UserQuery.Main() in C:\Users\mdziadowiec\AppData\Local\Temp\LINQPad7_gjidwyrb\cujkay\LINQPadQuery:line 13
at LINQPad.ExecutionModel.ClrQueryRunner.Run()
at LINQPad.ExecutionModel.Server.RunQuery(QueryRunner runner)
Comments
This is a bug/issue in BenchmarkDotNet 0.13.3. I've logged the issue, so hopefully it will be fixed in the next release.
In the meantime, you can work around this by using BenchmarkDotNet 0.13.2. From NuGet Package Manager, click "Download different version" and choose 0.13.2.
The PR I submitted for BenchmarkDotNet has been accepted, so this should work again in 0.13.4.