BenchmarkDotNet
BenchmarkDotNet copied to clipboard
Diagnostic Output - MemoryDiagnoser: InvalidOperationException: Sequence contains no elements
Just make my first benchmark. Unfortunatelly at the end of execution in section of Diagnostic Output - MemoryDiagnoser
I've got an exception and don't know what is causing it.
public class Program
{
public static void Main(string[] args) => BenchmarkSwitcher
.FromAssembly(typeof(Program).Assembly)
.Run(args);
}
[RankColumn]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
[MemoryDiagnoser]
public class TrimBenchmark
{
private const string value = "test56 320895y23r203 2=30592 35023 5789";
private const string suffix = "...";
private const byte maxLength = 10;
[Benchmark]
public string TrimOld() => value.TrimOld(maxLength, suffix);
[Benchmark]
public string TrimSpan() => value.Trim(maxLength, suffix);
}
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.19044.1620 (21H2)
Intel Core i7-9700K CPU 3.60GHz (Coffee Lake), 1 CPU, 8 logical and 8 physical cores
[Host] : .NET Framework 4.8 (4.8.4470.0), X64 RyuJIT
Job-FYOECP : .NET 6.0.3 (6.0.322.12309), X64 RyuJIT
Job-XTPWQX : .NET Framework 4.8 (4.8.4470.0), X64 RyuJIT
Unhandled Exception: System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at BenchmarkDotNet.Diagnosers.CompositeDiagnoser.DisplayResults(ILogger logger)
at BenchmarkDotNet.Running.BenchmarkRunnerClean.PrintSummary(ILogger logger, ImmutableConfig config, Summary summary)
at BenchmarkDotNet.Running.BenchmarkRunnerClean.Run(BenchmarkRunInfo[] benchmarkRunInfos)
at BenchmarkDotNet.Running.BenchmarkSwitcher.RunWithDirtyAssemblyResolveHelper(String[] args, IConfig config, Boolean askUserForInput)
at BenchmarkDotNet.Running.BenchmarkSwitcher.Run(String[] args, IConfig config)
at Liquid.Extensions.Benchmarks.Program.Main(String[] args) in C:\Projects\timeharmony.tenant\src\!Liquid\Benchmarks\Liquid.Extensions.Benchmarks\Program.cs:line 7
Hi @dario-l
Is there any chance that your benchmark is throwing? If so, I think I've already solved this problem in #1903, but a new version containing the fix has not been yet published to nuget.org.
Could you please try our preview package from https://benchmarkdotnet.org/articles/guides/nuget.html#nightly and see if it helps?
closing due to no response