BenchmarkDotNet
BenchmarkDotNet copied to clipboard
Results are not saved to file when running via command line
Running the project from Visual Studio creates the results folder in the parent directory just fine. However, running the program from the command line does not produce any output files for some reason.
My Program.cs contains this: BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);, and I run the benchmark via the command line like this: dotnet run -c Release --framework net7.0, from the project directory.
What is the difference between running it from VS and the command line, and why does the latter not produce the results files?
I suspect that the current directory is different and the files get created in a different folder. Could you please see if it's true?
Hi @adamsitnik, I searched the entire directory structured but the folder is unfortunately not showing up anywhere. I will try and share the project soon so you can see for yourself.
Hi @adamsitnik, it seems that running the project from the console has the effect of the results path being much, much further up. I have now located it in the root directory of my hard drive, which is 7 levels further up than when running it from VS... Any idea why that might be?
I also just noticed that adding --filters to the command causes no results to be written at all. It works fine without and then selecting the benchmark(s) to run, but I need to run it as a single command without user interaction.
Any idea why that might be?
VS must be setting a different working directory. You can check it by adding following code to your console app:
System.Console.WriteLine(System.Environment.CurrentDirectory);
I also just noticed that adding
--filtersto the command causes no results to be written at all.
Are you providing a correct filter that matches some benchmarks?
VS must be setting a different working directory. You can check it by adding following code to your console app:
I did do that, and while I can't remember the exact result now, it was not anything useful. I will try again.
Are you providing a correct filter that matches some benchmarks?
Yes they run just fine with the provided filter.