When working with gRPC in C#, asynchronous calls return AsyncUnaryCall<T>
(for unary calls - of course, other calls have slightly different return types). However, AsyncUnaryCall<T>
does not extend Task<T>
. Therefore, common things you would ordinarily do with a Task<T>
do not work with AsyncUnaryCall<T>
. This includes:
- specifying the continuation policy (using
ConfigureAwait
) - using helpers like
Task.WhenAny
andTask.WhenAll
The latter is biting me at the moment, since I want to kick off multiple gRPC calls and wait for them all to complete. It seems my only recourse is to write a little helper that awaits for one after the other.
Why doesn't AsyncUnaryCall<T>
mirror the functionality in Task<T>
?