File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -155,15 +155,17 @@ private Task<TestMetadata> CreateMetadataFromDynamicDiscoveryResult(DynamicDisco
155155
156156 private static Attribute [ ] GetDynamicTestAttributes ( DynamicDiscoveryResult result )
157157 {
158+ if ( result . TestClassType == null )
159+ {
160+ return result . Attributes . ToArray ( ) ;
161+ }
162+
158163 // Merge explicitly provided attributes with inherited class/assembly attributes
159164 // Order matches GetAllAttributes: method-level first (explicit), then class, then assembly
160165 var attributes = new List < Attribute > ( result . Attributes ) ;
161166
162- if ( result . TestClassType != null )
163- {
164- attributes . AddRange ( result . TestClassType . GetCustomAttributes ( ) . OfType < Attribute > ( ) ) ;
165- attributes . AddRange ( result . TestClassType . Assembly . GetCustomAttributes ( ) . OfType < Attribute > ( ) ) ;
166- }
167+ attributes . AddRange ( result . TestClassType . GetCustomAttributes ( ) ) ;
168+ attributes . AddRange ( result . TestClassType . Assembly . GetCustomAttributes ( ) ) ;
167169
168170 return attributes . ToArray ( ) ;
169171 }
Original file line number Diff line number Diff line change @@ -1932,15 +1932,17 @@ private Task<TestMetadata> CreateMetadataFromDynamicDiscoveryResult(DynamicDisco
19321932
19331933 private static Attribute [ ] GetDynamicTestAttributes ( DynamicDiscoveryResult result )
19341934 {
1935+ if ( result . TestClassType == null )
1936+ {
1937+ return result . Attributes . ToArray ( ) ;
1938+ }
1939+
19351940 // Merge explicitly provided attributes with inherited class/assembly attributes
19361941 // Order matches GetAllAttributes: method-level first (explicit), then class, then assembly
19371942 var attributes = new List < Attribute > ( result . Attributes ) ;
19381943
1939- if ( result . TestClassType != null )
1940- {
1941- attributes . AddRange ( result . TestClassType . GetCustomAttributes ( ) . OfType < Attribute > ( ) ) ;
1942- attributes . AddRange ( result . TestClassType . Assembly . GetCustomAttributes ( ) . OfType < Attribute > ( ) ) ;
1943- }
1944+ attributes . AddRange ( result . TestClassType . GetCustomAttributes ( ) ) ;
1945+ attributes . AddRange ( result . TestClassType . Assembly . GetCustomAttributes ( ) ) ;
19441946
19451947 return attributes . ToArray ( ) ;
19461948 }
You can’t perform that action at this time.
0 commit comments