Skip to content

Commit 8fd94c9

Browse files
committed
Return old behaviour and execute void benchmarks
1 parent 7e9fa0c commit 8fd94c9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/BenchmarkDotNet/Validators/ReturnValueValidator.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ protected override void ExecuteBenchmarks(IEnumerable<BenchmarkExecutor> executo
2727

2828
foreach (var executor in parameterGroup.DistinctBy(e => e.BenchmarkCase.Descriptor.WorkloadMethod))
2929
{
30-
if (executor.BenchmarkCase.Descriptor.WorkloadMethod.ReturnType == typeof(void))
31-
return;
32-
3330
try
3431
{
3532
var result = executor.Invoke();
36-
results.Add((executor.BenchmarkCase, result));
33+
34+
if (executor.BenchmarkCase.Descriptor.WorkloadMethod.ReturnType != typeof(void))
35+
results.Add((executor.BenchmarkCase, result));
3736
}
3837
catch (Exception ex)
3938
{
@@ -159,4 +158,4 @@ static Array ToStructuralEquatable(object obj)
159158
public int GetHashCode(object obj) => StructuralComparisons.StructuralEqualityComparer.GetHashCode(obj);
160159
}
161160
}
162-
}
161+
}

0 commit comments

Comments
 (0)