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