Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/SignalR/common/Shared/ReflectionHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

#nullable disable

Expand Down Expand Up @@ -39,7 +39,10 @@ public static bool IsIAsyncEnumerable(Type type)
{
if (type.IsGenericType)
{
return type.GetGenericTypeDefinition() == typeof(IAsyncEnumerable<>);
if (type.GetGenericTypeDefinition() == typeof(IAsyncEnumerable<>))
{
return true;
}
}

return type.GetInterfaces().Any(t =>
Expand Down
14 changes: 14 additions & 0 deletions src/SignalR/server/SignalR/test/Internal/ReflectionHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ async IAsyncEnumerable<int> Stream()
typeof(CustomAsyncEnumerable),
true
};

yield return new object[]
{
typeof(CustomAsyncEnumerableOfT<object>),
true
};
}

private class CustomAsyncEnumerable : IAsyncEnumerable<object>
Expand All @@ -66,5 +72,13 @@ public IAsyncEnumerator<object> GetAsyncEnumerator(CancellationToken cancellatio
throw new NotImplementedException();
}
}

private class CustomAsyncEnumerableOfT<T> : IAsyncEnumerable<object>
{
public IAsyncEnumerator<object> GetAsyncEnumerator(CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
}
}
}