✅ Where does BenchmarkDotNet save my files?

I can run the following successfully but I cannot find where the files A.txt and B.txt are saved. Where are they saved?
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

BenchmarkRunner.Run<MyBenchmark>();


[MemoryDiagnoser]
public class MyBenchmark
{
Guid Id = Guid.NewGuid();

StreamWriter writerA = null!;
StreamWriter writerB = null!;

[GlobalSetup]
public void GlobalSetup()
{
writerA = new("A.txt");
writerB = new("B.txt");
}

[GlobalCleanup]
public void GlobalCleanup()
{
writerA?.Dispose();
writerB?.Dispose();
}

[Benchmark]
public async Task A() => await writerA.WriteLineAsync(Id.ToString());

[Benchmark]
public async Task B() => await writerB.WriteLineAsync(Id.ToString());
}
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

BenchmarkRunner.Run<MyBenchmark>();


[MemoryDiagnoser]
public class MyBenchmark
{
Guid Id = Guid.NewGuid();

StreamWriter writerA = null!;
StreamWriter writerB = null!;

[GlobalSetup]
public void GlobalSetup()
{
writerA = new("A.txt");
writerB = new("B.txt");
}

[GlobalCleanup]
public void GlobalCleanup()
{
writerA?.Dispose();
writerB?.Dispose();
}

[Benchmark]
public async Task A() => await writerA.WriteLineAsync(Id.ToString());

[Benchmark]
public async Task B() => await writerB.WriteLineAsync(Id.ToString());
}
6 Replies
jscarle
jscarle4mo ago
They are in a folder named BenchmarkDotNet.Artifacts\results inside the bin folder.
i like chatgpt
i like chatgpt4mo ago
No. There are no A.txt and B.txt there.
jscarle
jscarle4mo ago
Its a single text file for the class., not per test.
i like chatgpt
i like chatgpt4mo ago
Nothing.
i like chatgpt
i like chatgpt4mo ago
No description
SinFluxx
SinFluxx4mo ago
try and chuck in Console.WriteLine(Path.GetFullPath("A.txt"); after it's created probably gets put in a temporary folder that gets cleaned up after the run