@@ -73,7 +73,7 @@ private async Task<object> CreateInstance(TestMetadata metadata, Type[] resolved
7373
7474 // First try to create instance with ClassConstructor attribute
7575 // Use attributes from context if available
76- var attributes = builderContext . InitializedAttributes ?? metadata . AttributeFactory ( ) ;
76+ var attributes = builderContext . InitializedAttributes ?? metadata . GetOrCreateAttributes ( ) ;
7777
7878 var instance = await ClassConstructorHelper . TryCreateInstanceWithClassConstructor (
7979 attributes ,
@@ -154,7 +154,7 @@ public async Task<IEnumerable<AbstractExecutableTest>> BuildTestsFromMetadataAsy
154154 var repeatCount = metadata . RepeatCount ?? 0 ;
155155
156156 // Create and initialize attributes ONCE
157- var attributes = await InitializeAttributesAsync ( metadata . AttributeFactory . Invoke ( ) ) ;
157+ var attributes = await InitializeAttributesAsync ( metadata . GetOrCreateAttributes ( ) ) ;
158158
159159 if ( metadata . ClassDataSources . Any ( ds => ds is IAccessesInstanceData ) )
160160 {
@@ -1017,7 +1017,7 @@ private static void CollectAllDependencies(AbstractExecutableTest test, HashSet<
10171017 /// </summary>
10181018 private static string ? GetBasicSkipReason ( TestMetadata metadata , Attribute [ ] ? cachedAttributes = null )
10191019 {
1020- var attributes = cachedAttributes ?? metadata . AttributeFactory ( ) ;
1020+ var attributes = cachedAttributes ?? metadata . GetOrCreateAttributes ( ) ;
10211021
10221022 SkipAttribute ? firstSkipAttribute = null ;
10231023
@@ -1047,7 +1047,7 @@ private static void CollectAllDependencies(AbstractExecutableTest test, HashSet<
10471047 private async ValueTask < TestContext > CreateTestContextAsync ( string testId , TestMetadata metadata , TestData testData , TestBuilderContext testBuilderContext )
10481048 {
10491049 // Use attributes from context if available, or create new ones
1050- var attributes = testBuilderContext . InitializedAttributes ?? await InitializeAttributesAsync ( metadata . AttributeFactory . Invoke ( ) ) ;
1050+ var attributes = testBuilderContext . InitializedAttributes ?? await InitializeAttributesAsync ( metadata . GetOrCreateAttributes ( ) ) ;
10511051
10521052 if ( testBuilderContext . DataSourceAttribute != null && testBuilderContext . DataSourceAttribute is not NoDataSource )
10531053 {
@@ -1138,7 +1138,7 @@ private async Task<AbstractExecutableTest> CreateFailedTestForDataGenerationErro
11381138
11391139 private async Task < TestDetails > CreateFailedTestDetails ( TestMetadata metadata , string testId )
11401140 {
1141- var attributes = ( await InitializeAttributesAsync ( metadata . AttributeFactory . Invoke ( ) ) ) ;
1141+ var attributes = ( await InitializeAttributesAsync ( metadata . GetOrCreateAttributes ( ) ) ) ;
11421142 return new TestDetails ( attributes )
11431143 {
11441144 TestId = testId ,
@@ -1524,7 +1524,7 @@ public async IAsyncEnumerable<AbstractExecutableTest> BuildTestsStreamingAsync(
15241524 var repeatCount = metadata . RepeatCount ?? 0 ;
15251525
15261526 // Initialize attributes
1527- var attributes = await InitializeAttributesAsync ( metadata . AttributeFactory . Invoke ( ) ) ;
1527+ var attributes = await InitializeAttributesAsync ( metadata . GetOrCreateAttributes ( ) ) ;
15281528
15291529 // Create base context with ClassConstructor if present
15301530 // StateBag and Events are lazy-initialized for performance
0 commit comments