Skip to content

Remaining argument-row and property-source checks match attributes by simple name #7650

Closed

Description

@thomhurst

Summary

The source generator still identifies some data-source attributes by their simple names. Unrelated attributes named ArgumentsAttribute, or custom property data sources named MethodDataSourceAttribute, can therefore enter parsing paths intended for TUnit attributes. Use qualified identities consistently so custom metadata is not interpreted as built-in rows.

Reproduction

Source inspection at commit 7780a6a on main shows simple-name checks in src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs (including lines 1050, 1060 and the class argument filtering near 1281), and src/TUnit.Core.SourceGenerator/CodeGenerators/StaticPropertyInitializationGenerator.cs lines 318–322. Apply a lookalike Arguments attribute to a generic class alongside real data sources; separately exercise a custom property data source with a built-in simple name. An end-to-end failure has not yet been established; regression fixtures should establish which branches are reachable.

Proposal

Audit these remaining argument-row and static-property checks, replace reachable built-in classification with qualified identity checks, and add regression fixtures with lookalike attributes. Check generated and reflection discovery agree where both modes apply. Consolidate repeated identity literals/helpers and avoid repeated symbol display conversion in the affected loops.

Environment

Source inspected on macOS at main commit 7780a6a and PR head e032133. This follows non-blocking review suggestions on #7649; that PR fixes method-source classification in generic test inference, while this issue covers remaining argument-row and property paths.

Please make the remaining built-in data-source classification ignore unrelated attributes with the same simple names.

Activity

  1. added
    bugSomething isn't working
    P3Low: cleanup, minor enhancement, or rare edge case
    on Nov 5, 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

    P3Low: cleanup, minor enhancement, or rare edge casebugSomething isn't workingin-progressWork is in progress

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions