Skip to content

Commit a3772bf

Browse files
committed
chore: revert changes of BenchmarkEnumerator.cs
1 parent 1caecbe commit a3772bf

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/BenchmarkDotNet.TestAdapter/BenchmarkEnumerator.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using BenchmarkDotNet.Extensions;
22
using BenchmarkDotNet.Helpers;
33
using BenchmarkDotNet.Running;
4+
using BenchmarkDotNet.Toolchains;
45
using System;
56
using System.IO;
67
using System.Linq;
@@ -44,14 +45,26 @@ public static BenchmarkRunInfo[] GetBenchmarksFromAssemblyPath(string assemblyPa
4445

4546
var assembly = Assembly.LoadFrom(assemblyPath);
4647

48+
var isDebugAssembly = assembly.IsJitOptimizationDisabled() ?? false;
49+
4750
return GenericBenchmarksBuilder.GetRunnableBenchmarks(assembly.GetRunnableBenchmarks())
4851
.Select(type =>
4952
{
5053
var benchmarkRunInfo = BenchmarkConverter.TypeToBenchmarks(type);
54+
if (isDebugAssembly)
55+
{
56+
// If the assembly is a debug assembly, then only display them if they will run in-process
57+
// This will allow people to debug their benchmarks using VSTest if they wish.
58+
benchmarkRunInfo = new BenchmarkRunInfo(
59+
benchmarkRunInfo.BenchmarksCases.Where(c => c.GetToolchain().IsInProcess).ToArray(),
60+
benchmarkRunInfo.Type,
61+
benchmarkRunInfo.Config);
62+
}
63+
5164
return benchmarkRunInfo;
5265
})
5366
.Where(runInfo => runInfo.BenchmarksCases.Length > 0)
5467
.ToArray();
5568
}
5669
}
57-
}
70+
}

0 commit comments

Comments
 (0)