Conversation
…ismatches - Fix dispatch in Analyze() to route ITypedDataSourceAttribute<T> implementations to CheckDataGenerator() - Fix interface detection filter to use AllInterfaces for indirect IDataSourceAttribute implementations - Fix CheckDataGenerator to use GloballyQualifiedNonGeneric() for correct open generic comparison - Add tests for TypedDataSourceAttribute parameter validation Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
|
@copilot We shouldn'thave to check if it's a |
…special-casing subtypes Address review feedback: instead of checking for ITypedDataSourceAttribute specifically, use the base IDataSourceAttribute interface to route ALL data source attributes to CheckDataGenerator(). Added continue statements to prevent double-dispatching for attributes already handled by specific handlers (Arguments, MethodDataSource). Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
Refactored in 42e4de5. The dispatch now uses |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. This PR correctly fixes three related bugs in the analyzer:
The logic changes are sound and the tests properly validate the fixes. |
TUnit0001 (argument/parameter mismatch) was not firing for
TypedDataSourceAttribute<T>/ITypedDataSourceAttribute<T>and other customIDataSourceAttributeimplementations, allowing mismatched test signatures to compile silently and fail only at runtime.Three bugs in
TestDataAnalyzer.cs:currentType.Interfaces(direct only) instead ofAllInterfaces, so types implementingIDataSourceAttributetransitively throughITypedDataSourceAttribute<T>were invisible to the analyzerCheckDataGenerator— only checked for specific base classes (DataSourceGeneratorAttribute/AsyncDataSourceGeneratorAttribute) by name; replaced with a genericIDataSourceAttributeinterface check that works for all data source implementations, including custom user-created ones. Addedcontinuestatements to prevent double-dispatching for attributes already handled by specific handlers (Arguments, MethodDataSource).ConstructedFrom.GloballyQualified()(returnsITypedDataSourceAttribute<T>) against backtick-arity format (ITypedDataSourceAttribute`1); fixed to useGloballyQualifiedNonGeneric()which strips type parameters for a correct match. This also fixes the same broken comparison that already existed inCheckDataGeneratorbut was unreachable due to the dispatch bug.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.