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]; + } } }