@@ -287,7 +287,7 @@ await _objectLifecycleService.RegisterObjectAsync(
287287 ClassConstructor = testBuilderContext . ClassConstructor
288288 } ;
289289
290- PropagateStateBag ( testBuilderContext , contextAccessor . Current ) ;
290+ testBuilderContext . CopyStateBagTo ( contextAccessor . Current ) ;
291291
292292 var ( classDataUnwrapped , classRowMetadata ) = DataUnwrapper . UnwrapWithMetadata ( await classDataFactory ( ) ?? [ ] ) ;
293293 classData = classDataUnwrapped ;
@@ -486,7 +486,7 @@ await _objectLifecycleService.RegisterObjectAsync(
486486 InitializedAttributes = attributes
487487 } ;
488488
489- PropagateStateBag ( testBuilderContext , testSpecificContext ) ;
489+ testBuilderContext . CopyStateBagTo ( testSpecificContext ) ;
490490
491491 var test = await BuildTestAsync ( metadata , testData , testSpecificContext , cancellationToken : cancellationToken ) ;
492492 test . Context . SkipReason = skipReason ;
@@ -546,7 +546,7 @@ await _objectLifecycleService.RegisterObjectAsync(
546546 InitializedAttributes = attributes
547547 } ;
548548
549- PropagateStateBag ( testBuilderContext , testSpecificContext ) ;
549+ testBuilderContext . CopyStateBagTo ( testSpecificContext ) ;
550550
551551 var test = await BuildTestAsync ( metadata , testData , testSpecificContext , cancellationToken : cancellationToken ) ;
552552 test . Context . SkipReason = skipReason ;
@@ -1887,11 +1887,4 @@ internal bool CouldTestMatchFilter(ITestExecutionFilter filter, TestMetadata met
18871887 return _filterMatcher . CouldMatchFilter ( metadata , filter ) ;
18881888 }
18891889
1890- private static void PropagateStateBag ( TestBuilderContext source , TestBuilderContext target )
1891- {
1892- if ( source . RawStateBag is { IsEmpty : false } bag )
1893- {
1894- target . StateBag = new ConcurrentDictionary < string , object ? > ( bag ) ;
1895- }
1896- }
18971890}
0 commit comments