From f9784884ef1d42350a048c914366a99fc21e5c4f Mon Sep 17 00:00:00 2001 From: Brenton Farmer Date: Wed, 4 Sep 2024 19:38:42 -0700 Subject: [PATCH] A little more cleanup --- src/Hyperbee.AsyncExpressions/StateMachineBuilder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Hyperbee.AsyncExpressions/StateMachineBuilder.cs b/src/Hyperbee.AsyncExpressions/StateMachineBuilder.cs index aa017be..6a2581b 100644 --- a/src/Hyperbee.AsyncExpressions/StateMachineBuilder.cs +++ b/src/Hyperbee.AsyncExpressions/StateMachineBuilder.cs @@ -250,9 +250,9 @@ private static bool TryGetAwaiterType( Expression expr, out Type awaiterType ) static Type GetAwaiterType( Type taskType ) { - var genericArgument = taskType.IsGenericType ? taskType.GetGenericArguments()[0] : typeof(void); + var genericArgument = taskType.IsGenericType ? taskType.GetGenericArguments()[0] : null; - if ( genericArgument == typeof(void) || genericArgument.FullName == "System.Threading.Tasks.VoidTaskResult" ) + if ( genericArgument == null || genericArgument.FullName == "System.Threading.Tasks.VoidTaskResult" ) { return typeof(ConfiguredTaskAwaitable.ConfiguredTaskAwaiter); }