Skip to content

Conversation

@User0332
Copy link
Contributor

@User0332 User0332 commented Nov 28, 2025

Fixes #2860

Previous Behavior

Running BenchmarkRunner.Run(Assembly, config) with a filter that eliminated all benchmarks from any one type within the specified assembly would error No [Benchmark] attribute found on 'MyTypeWithFilteredOutCases' benchmark case and not run any benchmarks within the assembly.

New Behavior

Even if all the benchmarks from one type are completely filtered out, BenchmarkRunner.Run(Assembly, config) will still run the selected benchmarks from all other types within the assembly.

If the filter happens to eliminate all benchmarks across all types within the assembly, There are no benchmarks found will be printed and zero benchmarks will run.

@User0332
Copy link
Contributor Author

@dotnet-policy-service agree

@timcassell
Copy link
Collaborator

Can you please add a test for the new behavior?

@User0332
Copy link
Contributor Author

User0332 commented Nov 28, 2025

Done!

The name is kind of long though, let me know if I should change it.

@timcassell
Copy link
Collaborator

Thanks @User0332

@timcassell timcassell merged commit 4f4bef7 into dotnet:master Nov 29, 2025
9 checks passed
@timcassell timcassell added this to the v0.15.8 milestone Nov 29, 2025
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

Successfully merging this pull request may close these issues.

BenchmarkRunner cannot Run(Assembly) if the filter eliminates all benchmark cases in any type

2 participants