Collect declaration errors - #3268
Open
timcassell wants to merge 1 commit into
Open
timcassell wants to merge 1 commit into
timcassell wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Core changes:
BenchmarkRunInfogainsDeclarationErrors, andBenchmarkRunnerCleanmerges them to validation errors.Behavior changes:
--listand the test adapter enumerate a type that has one.BenchmarkRunnerCleansaidNo [Benchmark] attribute found on 'X'— what it says about a type with no benchmarks at all. It now says why the method was refused.TypeFilterdropped such a type before the runner saw it, so from the command line the error vanished and the run said the filter matched nothing. It now keeps a type that has something to report.Summary.ValidationFailed(e.Message, ...). It is now one ofSummary.ValidationErrors, and the title is a title.SourceReturnTypeValidatorsays the declared return type is not one it could have read from. The throw used to pre-empt the second, which is the more useful of the two.Bug fixes:
IEnumerable, which a type is free to implement differently from theIEnumerable<T>it declares. A row could therefore arrive that was not the declaredValueTuple, and the walk to its items failed reaching for a field with a message blaming BenchmarkDotNet. Both readings now check the row before reaching into it and name what arrived instead.BenchmarkDotNet.TestAdapterno longer loses these errors. All three of its reshapes rebuilt aBenchmarkRunInfothrough the constructor, which silently dropped whatever the caller did not name — so underdotnet testa type with a bad declaration would run its good benchmarks and report nothing.Breaking changes:
BenchmarkRunInfosealed and public constructors removed.WithBenchmarksandWithConfigadded to modify it instead.InvalidBenchmarkDeclarationExceptionremoved.Other Changes:
BenchmarkRunInfoandDescriptorvalidate the types of their inputs.Helpers.Assertionremoved in favour ofArgumentNullException.ThrowIfNull.