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

Results are not saved to file when running via command line #2448

Open
johannesmols opened this issue Oct 19, 2023 · 6 comments
Open

Results are not saved to file when running via command line #2448

johannesmols opened this issue Oct 19, 2023 · 6 comments

Comments

@johannesmols
Copy link

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?

@adamsitnik
Copy link
Member

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?

@johannesmols
Copy link
Author

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.

@johannesmols
Copy link
Author

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?

@johannesmols
Copy link
Author

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.

@adamsitnik
Copy link
Member

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 --filters to the command causes no results to be written at all.

Are you providing a correct filter that matches some benchmarks?

@johannesmols
Copy link
Author

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.

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