From e0188b9699268dfba6bc77d30851c286c8b9353e Mon Sep 17 00:00:00 2001 From: Medeni Baykal <433724+Haplois@users.noreply.github.com> Date: Thu, 13 May 2021 01:07:24 +0200 Subject: [PATCH] Reverting an unintended breaking-change. --- .../MSTest.CoreAdapter/Execution/TestMethodInfo.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Adapter/MSTest.CoreAdapter/Execution/TestMethodInfo.cs b/src/Adapter/MSTest.CoreAdapter/Execution/TestMethodInfo.cs index 6a3e6b9f71..1d4d0d13bb 100644 --- a/src/Adapter/MSTest.CoreAdapter/Execution/TestMethodInfo.cs +++ b/src/Adapter/MSTest.CoreAdapter/Execution/TestMethodInfo.cs @@ -93,7 +93,9 @@ public Attribute[] GetAllAttributes(bool inherit) } public TAttributeType[] GetAttributes(bool inherit) - where TAttributeType : Attribute => ReflectHelper.GetAttributes(this.TestMethod, inherit); + where TAttributeType : Attribute + => ReflectHelper.GetAttributes(this.TestMethod, inherit) + ?? EmptyHolder.Array; /// /// Execute test method. Capture failures, handle async and return result. @@ -784,5 +786,10 @@ void executeAsyncAction() return timeoutResult; } } + + private static class EmptyHolder + { + internal static readonly T[] Array = new T[0]; + } } }