Skip to content

Commit 584fe39

Browse files
committed
Compare types directly.
1 parent 2a5de17 commit 584fe39

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/BenchmarkDotNet/Helpers/AwaitHelper.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ internal static MethodInfo GetGetResultMethod(Type taskType)
100100
{
101101
if (m.Name != nameof(AwaitHelper.GetResult)) return false;
102102
Type paramType = m.GetParameters().First().ParameterType;
103-
// We have to compare the types indirectly, == check doesn't work.
104-
return paramType.Assembly == compareType.Assembly && paramType.Namespace == compareType.Namespace && paramType.Name == compareType.Name;
103+
return paramType.IsGenericType && paramType.GetGenericTypeDefinition() == compareType;
105104
})
106105
.MakeGenericMethod(new[] { resultType });
107106
}

0 commit comments

Comments
 (0)