diff --git a/TUnit.Core/Attributes/TestData/MethodDataSourceAttribute.cs b/TUnit.Core/Attributes/TestData/MethodDataSourceAttribute.cs index dda7c5cb9d..7a3ee37aaf 100644 --- a/TUnit.Core/Attributes/TestData/MethodDataSourceAttribute.cs +++ b/TUnit.Core/Attributes/TestData/MethodDataSourceAttribute.cs @@ -77,9 +77,21 @@ public class MethodDataSourceAttribute : Attribute, IDataSourceAttribute public string MethodNameProvidingDataSource { get; } /// - /// Gets or sets an AOT-safe factory function for providing test data programmatically. - /// When set, this factory is used instead of reflection-based member lookup. + /// Gets or sets an AOT-safe factory function that provides test data without reflection. /// + /// + /// + /// This property is automatically populated by the TUnit source generator at compile time + /// and is not intended to be set manually in attribute syntax. Because C# attributes only support + /// literal values as arguments, a cannot be assigned in an attribute + /// declaration. + /// + /// + /// When the source generator processes a [MethodDataSource] attribute, it emits code that + /// sets this property to a generated delegate that invokes the named method directly — bypassing + /// reflection and enabling compatibility with Native AOT and IL trimming. + /// + /// public Func>>>? Factory { get; set; } ///