5 types derived from ChannelReader
Microsoft.AspNetCore.SignalR.Tests (1)
HubConnectionHandlerTestUtils\Hubs.cs (1)
871public class AsyncEnumerableImplChannelThrows<T> : ChannelReader<T>, IAsyncEnumerable<T>
System.Threading.Channels (4)
System\Threading\Channels\BoundedChannel.cs (1)
60private sealed class BoundedChannelReader : ChannelReader<T>, IDebugEnumerable<T>
System\Threading\Channels\SingleConsumerUnboundedChannel.cs (1)
53private sealed class UnboundedChannelReader : ChannelReader<T>, IDebugEnumerable<T>
System\Threading\Channels\UnboundedChannel.cs (1)
42private sealed class UnboundedChannelReader : ChannelReader<T>, IDebugEnumerable<T>
System\Threading\Channels\UnboundedPriorityChannel.cs (1)
48private sealed class UnboundedPrioritizedChannelReader : ChannelReader<T>, IDebugEnumerable<T>
198 references to ChannelReader
Aspire.Confluent.Kafka (1)
MetricsChannel.cs (1)
23public ChannelReader<string> Reader => _channel.Reader;
ClientSample (2)
StreamingSample.cs (1)
33var reader = await connection.StreamAsChannelAsync<int>("ChannelCounter", 10, 2000);
UploadSample.cs (1)
95var outputs = await connection.StreamAsChannelAsync<string>("StreamEcho", channel.Reader);
InMemory.FunctionalTests (2)
src\Servers\Kestrel\shared\test\Http3\Http3InMemory.cs (2)
92internal ChannelReader<KeyValuePair<Http3SettingType, long>> ServerReceivedSettingsReader => _serverReceivedSettings.Reader; 111var reader = MultiplexedConnectionContext.ToClientAcceptQueue.Reader;
Microsoft.AspNetCore.Http.Connections.Tests (2)
TestWebSocketConnectionFeature.cs (2)
59private readonly ChannelReader<WebSocketMessage> _input; 68public WebSocketChannel(ChannelReader<WebSocketMessage> input, ChannelWriter<WebSocketMessage> output, SyncPoint sync = null)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (2)
src\Servers\Kestrel\shared\test\Http3\Http3InMemory.cs (2)
92internal ChannelReader<KeyValuePair<Http3SettingType, long>> ServerReceivedSettingsReader => _serverReceivedSettings.Reader; 111var reader = MultiplexedConnectionContext.ToClientAcceptQueue.Reader;
Microsoft.AspNetCore.SignalR.Client.Core (42)
HubConnection.cs (8)
423/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 428public virtual async Task<ChannelReader<object?>> StreamAsChannelCoreAsync(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken = default) 676var reader = await StreamAsChannelCoreAsync(methodName, typeof(T), args, cts.Token).ConfigureAwait(false); 695private async Task<ChannelReader<object?>> StreamAsChannelCoreAsyncCore(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken) 734ChannelReader<object?> channel; 862throw new InvalidOperationException($"{reader.GetType()} is not a {typeof(ChannelReader<>).Name}."); 931private Task SendStreamItems<T>(ConnectionState connectionState, string streamId, ChannelReader<T> reader, CancellationTokenSource tokenSource) 1606async Task StartProcessingInvocationMessages(ChannelReader<InvocationMessage> invocationMessageChannelReader)
HubConnectionExtensions.StreamAsChannelAsync.cs (26)
27/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 30public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, CancellationToken cancellationToken = default) 45/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 48public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object? arg1, CancellationToken cancellationToken = default) 64/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 67public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, CancellationToken cancellationToken = default) 84/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 87public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, CancellationToken cancellationToken = default) 105/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 108public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, CancellationToken cancellationToken = default) 127/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 130public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, CancellationToken cancellationToken = default) 150/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 153public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, CancellationToken cancellationToken = default) 174/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 177public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, CancellationToken cancellationToken = default) 199/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 202public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, CancellationToken cancellationToken = default) 225/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 228public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, object? arg9, CancellationToken cancellationToken = default) 252/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 255public static Task<ChannelReader<TResult>> StreamAsChannelAsync<TResult>(this HubConnection hubConnection, string methodName, object? arg1, object? arg2, object? arg3, object? arg4, object? arg5, object? arg6, object? arg7, object? arg8, object? arg9, object? arg10, CancellationToken cancellationToken = default) 270/// The <see cref="Task{TResult}.Result"/> property returns a <see cref="ChannelReader{T}"/> for the streamed hub method values. 272public static async Task<ChannelReader<TResult>> StreamAsChannelCoreAsync<TResult>(this HubConnection hubConnection, string methodName, object?[] args, CancellationToken cancellationToken = default) 276var inputChannel = await hubConnection.StreamAsChannelCoreAsync(methodName, typeof(TResult), args, cancellationToken).ConfigureAwait(false); 287private static async Task RunChannel<TResult>(ChannelReader<object?> inputChannel, Channel<TResult> outputChannel)
Internal\InvocationRequest.cs (2)
56ILoggerFactory loggerFactory, HubConnection hubConnection, Activity? activity, out ChannelReader<object?> result) 88public ChannelReader<object?> Result => _channel.Reader;
src\SignalR\common\Shared\AsyncEnumerableAdapters.cs (5)
27public static IAsyncEnumerator<object?> MakeAsyncEnumeratorFromChannel<T>(ChannelReader<T> channel, CancellationToken cancellationToken = default) 34private readonly ChannelReader<T> _channel; 36public ChannelAsyncEnumerator(ChannelReader<T> channel, CancellationToken cancellationToken) 201private static readonly MethodInfo _channelReaderTryReadMethodInfo = typeof(ChannelReader<>).GetMethod("TryRead")!; 202private static readonly MethodInfo _channelReaderWaitToReadAsyncMethodInfo = typeof(ChannelReader<>).GetMethod("WaitToReadAsync")!;
src\SignalR\common\Shared\ReflectionHelper.cs (1)
33if (nullableType.IsGenericType && nullableType.GetGenericTypeDefinition() == typeof(ChannelReader<>))
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (39)
HubConnectionTests.cs (11)
769var channel = await connection.StreamAsChannelAsync<int>("Stream", 5).DefaultTimeout(); 800var channel = await connection.StreamAsChannelAsync<string>("StreamEcho", channelWriter.Reader).DefaultTimeout(); 848var channel = await connection.StreamAsChannelAsync<string>("StreamEcho", stream).DefaultTimeout(); 896var channel = await connection.StreamAsChannelAsync<int>("StreamEchoInt", stream, cts.Token).DefaultTimeout(); 979var channel = await connection.StreamAsChannelAsync<int>("Stream", 1000, cts.Token).DefaultTimeout(); 1052var channel = await connection.StreamAsChannelAsync<int>("StreamException").DefaultTimeout(); 1189var channel = await connection.StreamAsChannelAsync<int>("!@#$%"); 1217var channel = await connection.StreamAsChannelAsync<int>("Stream", 42, 42); 1245var channel = await connection.StreamAsChannelAsync<int>("Stream", "xyz"); 1272var channel = await connection.StreamAsChannelAsync<int>("HelloWorld").DefaultTimeout(); 1326var channel = await connection.StreamAsChannelAsync<int>("StreamBroken").DefaultTimeout();
Hubs.cs (28)
25public ChannelReader<int> Stream(int count) => TestHubMethodsImpl.Stream(count); 27public ChannelReader<int> StreamException() => TestHubMethodsImpl.StreamException(); 29public ChannelReader<string> StreamBroken() => TestHubMethodsImpl.StreamBroken(); 46public ChannelReader<string> StreamEcho(ChannelReader<string> source) => TestHubMethodsImpl.StreamEcho(source); 48public ChannelReader<int> StreamEchoInt(ChannelReader<int> source) => TestHubMethodsImpl.StreamEchoInt(source); 147public ChannelReader<int> Stream(int count) => TestHubMethodsImpl.Stream(count); 149public ChannelReader<int> StreamException() => TestHubMethodsImpl.StreamException(); 151public ChannelReader<string> StreamBroken() => TestHubMethodsImpl.StreamBroken(); 168public ChannelReader<string> StreamEcho(ChannelReader<string> source) => TestHubMethodsImpl.StreamEcho(source); 170public ChannelReader<int> StreamEchoInt(ChannelReader<int> source) => TestHubMethodsImpl.StreamEchoInt(source); 183public ChannelReader<int> Stream(int count) => TestHubMethodsImpl.Stream(count); 185public ChannelReader<int> StreamException() => TestHubMethodsImpl.StreamException(); 187public ChannelReader<string> StreamBroken() => TestHubMethodsImpl.StreamBroken(); 204public ChannelReader<string> StreamEcho(ChannelReader<string> source) => TestHubMethodsImpl.StreamEcho(source); 206public ChannelReader<int> StreamEchoInt(ChannelReader<int> source) => TestHubMethodsImpl.StreamEchoInt(source); 225public static ChannelReader<int> Stream(int count) 243public static ChannelReader<int> StreamException() 248public static ChannelReader<string> StreamBroken() => null; 250public static ChannelReader<string> StreamEcho(ChannelReader<string> source) 274public static ChannelReader<int> StreamEchoInt(ChannelReader<int> source)
Microsoft.AspNetCore.SignalR.Client.Tests (21)
HubConnectionTests.cs (1)
853.Returns(() => Task.FromResult(It.IsAny<ChannelReader<object>>()));
HubConnectionTests.Protocol.cs (5)
209var channel = await hubConnection.StreamAsChannelAsync<object>("Foo").DefaultTimeout(); 258var channel = await hubConnection.StreamAsChannelAsync<int>("Foo").DefaultTimeout(); 325var channel = await hubConnection.StreamAsChannelAsync<string>("Foo").DefaultTimeout(); 348var channel = await hubConnection.StreamAsChannelAsync<int>("Foo").DefaultTimeout(); 394var channel = await hubConnection.StreamAsChannelAsync<string>("Foo").DefaultTimeout();
HubConnectionTests.Tracing.cs (1)
78var channel = await hubConnection.StreamAsChannelAsync<object>("Foo").DefaultTimeout();
HubServerProxyGeneratorTests.cs (14)
36Task<ChannelReader<int>> StreamToClientViaChannel(); 37Task<ChannelReader<int>> StreamToClientViaChannelWithToken(CancellationToken cancellationToken); 39Task StreamFromClientViaChannel(ChannelReader<int> reader); 41Task<int> StreamFromClientButAlsoReturnValue(ChannelReader<int> reader); 42Task<ChannelReader<int>> StreamBidirectionalViaChannel(ChannelReader<float> reader); 43Task<ChannelReader<int>> StreamBidirectionalViaChannelWithToken(ChannelReader<float> reader, CancellationToken cancellationToken); 217var channelReader = channel.Reader; 224It.Is<object[]>(y => ((object[])y).Any(z => (ChannelReader<int>)z == channelReader)), 237It.Is<object[]>(y => ((object[])y).Any(z => (ChannelReader<int>)z == channelReader)), 259var retChannelReader = retChannel.Reader; 271It.Is<object[]>(y => ((object[])y).Any(z => z is ChannelReader<float>)), 278It.Is<object[]>(y => ((object[])y).Any(z => z is ChannelReader<float>)),
Microsoft.AspNetCore.SignalR.Core (7)
Internal\HubMethodDescriptor.cs (1)
51if (returnType.IsGenericType && returnType.GetGenericTypeDefinition() == typeof(ChannelReader<>))
src\SignalR\common\Shared\AsyncEnumerableAdapters.cs (5)
27public static IAsyncEnumerator<object?> MakeAsyncEnumeratorFromChannel<T>(ChannelReader<T> channel, CancellationToken cancellationToken = default) 34private readonly ChannelReader<T> _channel; 36public ChannelAsyncEnumerator(ChannelReader<T> channel, CancellationToken cancellationToken) 201private static readonly MethodInfo _channelReaderTryReadMethodInfo = typeof(ChannelReader<>).GetMethod("TryRead")!; 202private static readonly MethodInfo _channelReaderWaitToReadAsyncMethodInfo = typeof(ChannelReader<>).GetMethod("WaitToReadAsync")!;
src\SignalR\common\Shared\ReflectionHelper.cs (1)
33if (nullableType.IsGenericType && nullableType.GetGenericTypeDefinition() == typeof(ChannelReader<>))
Microsoft.AspNetCore.SignalR.Microbenchmarks (7)
DefaultHubDispatcherBenchmark.cs (7)
134public ChannelReader<int> StreamChannelReader() 142public Task<ChannelReader<int>> StreamChannelReaderAsync() 147return Task.FromResult<ChannelReader<int>>(channel); 150public ValueTask<ChannelReader<int>> StreamChannelReaderValueTaskAsync() 155return new ValueTask<ChannelReader<int>>(channel); 158public ChannelReader<int> StreamChannelReaderCount(int count) 194public async Task UploadStream(ChannelReader<string> channelReader)
Microsoft.AspNetCore.SignalR.Tests (45)
HubConnectionHandlerTestUtils\Hubs.cs (39)
191public async Task<string> StreamingConcat(ChannelReader<string> source) 206public async Task StreamDontRead(ChannelReader<string> source) 213public async Task<int> StreamingSum(ChannelReader<int> source) 226public async Task<List<object>> UploadArray(ChannelReader<object> source) 242public async Task<List<object>> UploadArrayAuth(ChannelReader<object> source) 257public async Task<string> TestTypeCastingErrors(ChannelReader<int> source) 271public async Task<bool> TestCustomErrorPassing(ChannelReader<int> source) 285public Task UploadIgnoreItems(ChannelReader<string> source) 291public ChannelReader<string> StreamAndUploadIgnoreItems(ChannelReader<string> source) 298async Task ChannelFunc(ChannelWriter<string> output, ChannelReader<string> input) 306public async Task UploadDoesWorkOnComplete(ChannelReader<string> source) 362public async Task<int> GetClientResultWithStream(ChannelReader<int> channelReader) 702public ChannelReader<string> CounterChannel(int count) 718public async Task<ChannelReader<string>> CounterChannelAsync(int count) 725public async Task<ChannelReader<string>> CounterChannelAsync2(int count) 731public async ValueTask<ChannelReader<string>> CounterChannelValueTaskAsync(int count) 771public ChannelReader<string> BlockingStream() 776public ChannelReader<int> ExceptionStream() 783public ChannelReader<int> ChannelClosedExceptionStream() 790public ChannelReader<int> ChannelClosedExceptionInnerExceptionStream() 797public ChannelReader<int> ThrowStream() 802public ChannelReader<int> NullStream() 812public ChannelReader<string> StreamEcho(ChannelReader<string> source) 873private readonly ChannelReader<T> _inner; 875public AsyncEnumerableImplChannelThrows(ChannelReader<T> inner) 901private readonly ChannelReader<T> _channel; 907public ChannelAsyncEnumerator(ChannelReader<T> channel, CancellationToken cancellationToken) 1025public async Task<ChannelReader<string>> LongRunningStream() 1033public ChannelReader<int> CancelableStreamSingleParameter(CancellationToken token) 1048public ChannelReader<int> CancelableStreamMultiParameter(int ignore, int ignore2, CancellationToken token) 1063public ChannelReader<int> CancelableStreamNullableParameter(int x, string y, CancellationToken token) 1078public ChannelReader<int> StreamNullableParameter(int x, int? input) 1093public ChannelReader<int> CancelableStreamMiddleParameter(int ignore, CancellationToken token, int ignore2) 1129public ChannelReader<int> CountingCancelableStreamGeneratedChannel(int count, CancellationToken token) 1159public async Task Upload(ChannelReader<string> stream) 1375public async Task<int> ServicesAndParams(int value, [FromService] Service1 service, ChannelReader<int> channelReader, [FromService] Service2 service2, bool value2) 1400public async Task Stream(ChannelReader<int> channelReader)
Internal\ReflectionHelperTests.cs (1)
32typeof(ChannelReader<object>),
NativeAotTests.cs (5)
247public ChannelReader<string> StreamEcho(ChannelReader<string> source) 280public ChannelReader<char> ReturnChannelValueType(string source) 321public async Task<string> ChannelShortParameter(ChannelReader<object> source) 345public async Task StreamValueType(ILogger<ChannelValueTypeMethodHub> logger, ChannelReader<double> source)
Microsoft.AspNetCore.SignalR.Tests.Utils (2)
ChannelExtensions.cs (2)
10public static async Task<List<T>> ReadAndCollectAllAsync<T>(this ChannelReader<T> channel, bool suppressExceptions = false) 37public static async Task<List<T>> ReadAtLeastAsync<T>(this ChannelReader<T> reader, int minimumCount, CancellationToken cancellationToken = default)
Microsoft.CodeAnalysis.CodeStyle (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\IAsyncEnumerableExtensions.cs (1)
82this ChannelReader<T> reader, [EnumeratorCancellation] CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ProducerConsumer.cs (3)
41ChannelReader<TItem> reader, 243Func<ChannelReader<TItem>, TArgs, CancellationToken, Task<TResult>> consumeItems, 279Func<ChannelReader<TItem>, TArgs, CancellationToken, Task<TResult>> consumeItems,
Microsoft.CodeAnalysis.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\IAsyncEnumerableExtensions.cs (1)
82this ChannelReader<T> reader, [EnumeratorCancellation] CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ProducerConsumer.cs (3)
41ChannelReader<TItem> reader, 243Func<ChannelReader<TItem>, TArgs, CancellationToken, Task<TResult>> consumeItems, 279Func<ChannelReader<TItem>, TArgs, CancellationToken, Task<TResult>> consumeItems,
SignalR.Client.FunctionalTestApp (5)
TestHub.cs (5)
60public ChannelReader<string> Stream() 70public ChannelReader<string> InfiniteStream(CancellationToken token) 83public async Task<string> StreamingConcat(ChannelReader<string> stream) 98public ChannelReader<int> EmptyStream() 105public ChannelReader<string> StreamThrowException(string message)
SignalRSamples (9)
Hubs\Streaming.cs (2)
21public ChannelReader<int> ObservableCounter(int count, double delay) 30public ChannelReader<int> ChannelCounter(int count, double delay)
Hubs\UploadHub.cs (6)
19public async Task<string> UploadWord(ChannelReader<string> source) 38public async Task<string> ScoreTracker(ChannelReader<int> player1, ChannelReader<int> player2) 46async Task<int> Loop(ChannelReader<int> reader) 63public ChannelReader<string> StreamEcho(ChannelReader<string> source)
ObservableExtensions.cs (1)
11public static ChannelReader<T> AsChannelReader<T>(
System.Threading.Channels (4)
System\Threading\Channels\Channel_2.cs (2)
15public ChannelReader<TRead> Reader { get; protected set; } = null!; // derived types should always set the Reader as part of construction 22public static implicit operator ChannelReader<TRead>(Channel<TWrite, TRead> channel) => channel.Reader;
System\Threading\Channels\ChannelReader.cs (2)
23/// <summary>Gets whether <see cref="Count"/> is available for use on this <see cref="ChannelReader{T}"/> instance.</summary> 26/// <summary>Gets whether <see cref="TryPeek"/> is available for use on this <see cref="ChannelReader{T}"/> instance.</summary>