Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostic Output - MemoryDiagnoser: InvalidOperationException: Sequence contains no elements #1980

Closed
dario-l opened this issue Apr 1, 2022 · 2 comments

Comments

@dario-l
Copy link

dario-l commented Apr 1, 2022

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
@adamsitnik
Copy link
Member

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?

@adamsitnik
Copy link
Member

closing due to no response

@adamsitnik adamsitnik closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants