You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Class-level data-source analyzers check rows against the first constructor, not the [TestConstructor] one #7370
Class-level data-source analyzers check rows against the class's first constructor, not the one marked [TestConstructor] that the test instance is actually built with. A class whose rows fit the marked constructor gets a false TUnit0001 error (and the matrix and combined-data-source analyzers have the same gap).
Build: error TUnit0001: Attribute argument types 'T, string' don't match method parameter types 'T'. Both engine modes run the test correctly (after #7336) through the [TestConstructor] constructor.
src/TUnit.Analyzers/MatrixAnalyzer.cs:30 and src/TUnit.Analyzers/CombinedDataSourceAnalyzer.cs:35: the same FirstOrDefault()
src/TUnit.Analyzers/Extensions/SymbolExtensions.cs:21: the same FirstOrDefault() in the shared parameter lookup; check its callers too
Expected
Analyzers validate class-level rows against the [TestConstructor] constructor when one is marked, otherwise the current first-constructor behaviour, matching the generator's instance factory (InstanceFactoryGenerator.GetPrimaryConstructor) and, since #7336, the class parameter metadata in both modes. The fixture OwnClassTupleMethodDataSourceWithTestConstructor in tests/TUnit.TestProject/Bugs/_7208 suppresses TUnit0001 for this reason; drop the suppression once fixed.
Activity
fix(engine): read class parameter metadata from the [TestConstructor]…
fix(engine): read a generic class's own class-level [MethodDataSource…
fix(analyzers): validate data against TestConstructor (#7370)
fix(analyzers): validate data against TestConstructor (#7370) (#7449)