Skip to content

Source-generated generic class inference ignores inherited Arguments rows #7490

Open
1 of 2 issues completed

Description

@thomhurst

Summary

Source-generated discovery cannot infer a generic test class from an inherited [Arguments(42)] constructor row. The same row declared on the derived class infers int. Inherited argument values are available at compile time, so this reports an unnecessary generic inference failure; explicitly adding [GenerateGenericTest(typeof(int))] works.

Reproduction

[Arguments(42)]
public abstract class Base;

public class Derived<T>(T value) : Base
{
    [Test]
    public void Test() { }
}

Run source-generated discovery with --treenode-filter "/*/*/Derived/*". Move [Arguments(42)] to Derived<T> to compare.

Expected and actual

Expected: one passing test with T = int, as for a directly declared row. Actual: one failed test saying the class type arguments cannot be inferred at compile time. Reflection discovery with the inherited-class-source fix runs one passing test.

Environment

TUnit source at 9100521, SDK 10.0.403, net10.0, macOS arm64. Observed in tests/TUnit.TestProject/Bugs/_7426/Tests.cs before adding explicit generic arguments while validating #7426.

Please include inherited [Arguments] rows in compile-time generic class inference.

Activity

  1. added
    P2Medium: edge case, mode divergence, flaky test, or workaround exists
    on Nov 3, 2026
  2. added 20 commits that reference this issue on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: edge case, mode divergence, flaky test, or workaround existsbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions