The `type.IsDefined(typeof(CompilerGeneratedAttribute))` check removed, since it led to the exclusion of `async lambdas`.
This commit is contained in:
samtrion
2019-12-06 11:25:15 +01:00
committed by Ben Adams
parent 58dadce795
commit 4f9f191f7f
2 changed files with 76 additions and 8 deletions

View File

@@ -116,10 +116,10 @@ namespace System.Diagnostics
var subMethodName = method.Name;
var methodName = method.Name;
if (type != null && type.IsDefined(typeof(CompilerGeneratedAttribute)) &&
(typeof(IAsyncStateMachine).IsAssignableFrom(type) || typeof(IEnumerator).IsAssignableFrom(type)))
var isAsyncStateMachine = typeof(IAsyncStateMachine).IsAssignableFrom(type);
if (isAsyncStateMachine || typeof(IEnumerator).IsAssignableFrom(type))
{
methodDisplayInfo.IsAsync = typeof(IAsyncStateMachine).IsAssignableFrom(type);
methodDisplayInfo.IsAsync = isAsyncStateMachine;
// Convert StateMachine methods to correct overload +MoveNext()
if (!TryResolveStateMachineMethod(ref method, out type))