From 04ca837b24b17f81e31e4cda4ba60029b2699a5a Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Sat, 19 Mar 2022 08:19:58 -0400 Subject: [PATCH] Avoid boxing array enumerator in StackTrace.TryResolveStateMachineMethod (#66836) --- .../System.Private.CoreLib/src/System/Diagnostics/StackTrace.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/StackTrace.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/StackTrace.cs index c86c3be39fe76e..81b0e58b12dc57 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/StackTrace.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/StackTrace.cs @@ -418,7 +418,7 @@ private static bool TryResolveStateMachineMethod(ref MethodBase method, out Type foreach (MethodInfo candidateMethod in methods) { - IEnumerable? attributes = candidateMethod.GetCustomAttributes(inherit: false); + StateMachineAttribute[]? attributes = (StateMachineAttribute[])Attribute.GetCustomAttributes(candidateMethod, typeof(StateMachineAttribute), inherit: false); if (attributes == null) { continue;