public Task <TResponse> ReadNext() { var taskSource = new AsyncCompletionTaskSource <TResponse>(); call.StartReadMessage(taskSource.CompletionDelegate); return(taskSource.Task); }
public async Task <bool> MoveNext(CancellationToken token) { if (token != CancellationToken.None) { throw new InvalidOperationException("Cancellation of individual reads is not supported."); } var taskSource = new AsyncCompletionTaskSource <TResponse>(); call.StartReadMessage(taskSource.CompletionDelegate); var result = await taskSource.Task; this.current = result; return(result != null); }
public async Task <bool> MoveNext(CancellationToken token) { if (token != CancellationToken.None) { throw new InvalidOperationException("Cancellation of individual reads is not supported."); } var taskSource = new AsyncCompletionTaskSource <TResponse>(); call.StartReadMessage(taskSource.CompletionDelegate); var result = await taskSource.Task.ConfigureAwait(false); this.current = result; if (result == null) { await call.StreamingCallFinishedTask.ConfigureAwait(false); return(false); } return(true); }