Skip to content

[Bug]: MethodDataSourceAttribute.Factory is incorrect #5834

Description

@kzrnm

Description

Attributes can only take literal values as parameters.

Since MethodDataSourceAttribute.Factory is Func<T>, it cannot be specified. Since it cannot be used, it is not documented either.

https://learn.microsoft.com/dotnet/csharp/language-reference/compiler-messages/parameter-argument-mismatch#arguments-for-attributes

This appears to be an LLM hallucination. #2600

Expected Behavior

Remove MethodDataSourceAttribute.Factory.

Actual Behavior

There is MethodDataSourceAttribute.Factory.

Steps to Reproduce

[MethodDataSource("Data", Factory = default)]

TUnit Version

1.43.11

.NET Version

.NET 9

Operating System

Windows

IDE / Test Runner

dotnet CLI (dotnet test / dotnet run)

Error Output / Stack Trace

Additional Context

No response

IDE-Specific Issue?

  • I've confirmed this issue occurs when running via dotnet test or dotnet run, not just in my IDE

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions