File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/BenchmarkDotNet.TestAdapter Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
using BenchmarkDotNet . Extensions ;
2
2
using BenchmarkDotNet . Helpers ;
3
3
using BenchmarkDotNet . Running ;
4
+ using BenchmarkDotNet . Toolchains ;
4
5
using System ;
5
6
using System . IO ;
6
7
using System . Linq ;
@@ -44,14 +45,26 @@ public static BenchmarkRunInfo[] GetBenchmarksFromAssemblyPath(string assemblyPa
44
45
45
46
var assembly = Assembly . LoadFrom ( assemblyPath ) ;
46
47
48
+ var isDebugAssembly = assembly . IsJitOptimizationDisabled ( ) ?? false ;
49
+
47
50
return GenericBenchmarksBuilder . GetRunnableBenchmarks ( assembly . GetRunnableBenchmarks ( ) )
48
51
. Select ( type =>
49
52
{
50
53
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
+
51
64
return benchmarkRunInfo ;
52
65
} )
53
66
. Where ( runInfo => runInfo . BenchmarksCases . Length > 0 )
54
67
. ToArray ( ) ;
55
68
}
56
69
}
57
- }
70
+ }
You can’t perform that action at this time.
0 commit comments