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
TestDataAnalyzer: detect Func<T> by symbol instead of display-string prefix #7380
TestDataAnalyzer detects Func<T> by calling ToDisplayString().StartsWith("System.Func<", StringComparison.Ordinal). This allocates a display string during analysis and relies on formatting instead of symbol identity.
Current code
Following merged PR #7347 (#7227), the three checks are:
Two property-injection checks in src/TUnit.Analyzers/TestDataAnalyzer.cs, using funcType and funcTypeForError.
TryUnwrapFunc in the same file, called while peeling the supported data-row wrappers.
Both automated reviewers raised this as non-blocking on #7347 (review comment). That prerequisite has merged; this issue is available for implementation.
Acceptance criteria
Resolve System.Func`1 once per compilation with Compilation.GetTypeByMetadataName("System.Func`1").
Compare OriginalDefinition with SymbolEqualityComparer.Default in all three checks, as the analyzer already does for TestDataRow<T>.
Preserve the existing wrapper-peeling order and property-injection behavior.
Add analyzer cases for Func<TestDataRow<(int, int)>> and TestDataRow<Func<(int, int)>> against an (int a, int b) test signature. These are regression coverage for the existing tuple expansion after wrapper peeling; there is no known defect in that ordering.
Triage update: #7347 has merged and #7227 is closed. TryUnwrapFunc is now on origin/main and still uses the display-string prefix, as do both property-injection checks. Removed the completed prerequisite link and incorporated the tuple-wrapper regression cases into the acceptance criteria.
An extra item from the Claude review of #7347 (comment 6570666000), to cover alongside the symbol-based Func<T> match: add analyzer tests for tuples inside the wrappers, for example Func<TestDataRow<(int, int)>> and TestDataRow<Func<(int, int)>> against a (int a, int b) test signature. UnwrapTypes still runs its tuple expansion after the fixed Func → TestDataRow → Func peel, so there is no known defect. The tests would lock that ordering in, and changing TryUnwrapFunc would touch the same path.
Activity
thomhurst commentedon Nov 2, 2026
Triage update: #7347 has merged and #7227 is closed.
TryUnwrapFuncis now onorigin/mainand still uses the display-string prefix, as do both property-injection checks. Removed the completed prerequisite link and incorporated the tuple-wrapper regression cases into the acceptance criteria.thomhurst commentedon Nov 2, 2026
An extra item from the Claude review of #7347 (comment 6570666000), to cover alongside the symbol-based
Func<T>match: add analyzer tests for tuples inside the wrappers, for exampleFunc<TestDataRow<(int, int)>>andTestDataRow<Func<(int, int)>>against a(int a, int b)test signature.UnwrapTypesstill runs its tuple expansion after the fixed Func → TestDataRow → Func peel, so there is no known defect. The tests would lock that ordering in, and changingTryUnwrapFuncwould touch the same path.