Support more IAsyncEnumerable types in SignalR (#24926)
This commit is contained in:
parent
1150b211cc
commit
a5263d61fb
|
|
@ -39,7 +39,10 @@ namespace Microsoft.AspNetCore.SignalR
|
||||||
{
|
{
|
||||||
if (type.IsGenericType)
|
if (type.IsGenericType)
|
||||||
{
|
{
|
||||||
return type.GetGenericTypeDefinition() == typeof(IAsyncEnumerable<>);
|
if (type.GetGenericTypeDefinition() == typeof(IAsyncEnumerable<>))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return type.GetInterfaces().Any(t =>
|
return type.GetInterfaces().Any(t =>
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,12 @@ namespace Microsoft.AspNetCore.SignalR.Tests.Internal
|
||||||
typeof(CustomAsyncEnumerable),
|
typeof(CustomAsyncEnumerable),
|
||||||
true
|
true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
yield return new object[]
|
||||||
|
{
|
||||||
|
typeof(CustomAsyncEnumerableOfT<object>),
|
||||||
|
true
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CustomAsyncEnumerable : IAsyncEnumerable<object>
|
private class CustomAsyncEnumerable : IAsyncEnumerable<object>
|
||||||
|
|
@ -66,5 +72,13 @@ namespace Microsoft.AspNetCore.SignalR.Tests.Internal
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class CustomAsyncEnumerableOfT<T> : IAsyncEnumerable<object>
|
||||||
|
{
|
||||||
|
public IAsyncEnumerator<object> GetAsyncEnumerator(CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue