Skip to content

Commit f68fd34

Browse files
authored
Reverting an unintended breaking-change. (microsoft#826)
Reverting an unintended breaking change in reflection. Thank you, @azchohfi, for reporting it; this makes microsoft#824 unnecessary.
1 parent 30aaca1 commit f68fd34

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Adapter/MSTest.CoreAdapter/Execution/TestMethodInfo.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ public Attribute[] GetAllAttributes(bool inherit)
9393
}
9494

9595
public TAttributeType[] GetAttributes<TAttributeType>(bool inherit)
96-
where TAttributeType : Attribute => ReflectHelper.GetAttributes<TAttributeType>(this.TestMethod, inherit);
96+
where TAttributeType : Attribute
97+
=> ReflectHelper.GetAttributes<TAttributeType>(this.TestMethod, inherit)
98+
?? EmptyHolder<TAttributeType>.Array;
9799

98100
/// <summary>
99101
/// Execute test method. Capture failures, handle async and return result.
@@ -784,5 +786,10 @@ void executeAsyncAction()
784786
return timeoutResult;
785787
}
786788
}
789+
790+
private static class EmptyHolder<T>
791+
{
792+
internal static readonly T[] Array = new T[0];
793+
}
787794
}
788795
}

0 commit comments

Comments
 (0)