Hi, I skimmed through your code and it looks alright (perhaps I missed something?). What line does throw in your case?
To answer your questions: The response stream is ready immediately after starting your call and you don't even need to send any requests nor close the request stream to be able to read from responseStream (so your code really should work). Also, if you need to just subscribe for server updates, perhaps the bi-streaming call is an overkill - you could start a server-streaming call, where you send a unary request (with you subscription details) and then keep reading from the response stream (but your example should work). Jan On Tue, Oct 4, 2016 at 8:42 PM, <naman.g.mu...@gmail.com> wrote: > Hello, > > I am trying to work on a grpc C# client that initiates a subscription type > call with a grpc server. I believe I sent the subscription correctly but am > not able to read from the response stream correctly. I try to await on the > AsyncEnumerator.MoveNext() task but I get a null reference exception on the > below code. > > var asyncCall = client.Subscribe(); > var responseStream = asyncCall.ResponseStream; > > await asyncCall.RequestStream.CompleteAsync(); > > while (await responseStream.MoveNext()) > { > var tresp = asyncCall.ResponseStream.Current; > // print tresp message. > } > > After having sent an RPC call, does the ResponseStream get initialized > immediately ? My guide for this has been https://github.com/grpc/grpc/ > blob/v1.0.0/examples/csharp/route_guide/RouteGuideClient/Program.cs. > > Thanks, > Naman > > > -- > You received this message because you are subscribed to the Google Groups " > grpc.io" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to grpc-io+unsubscr...@googlegroups.com. > To post to this group, send email to grpc-io@googlegroups.com. > Visit this group at https://groups.google.com/group/grpc-io. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/grpc-io/3c54b44d-bdeb-48c3-a0c3-c804dca2ca87%40googlegroups.com > <https://groups.google.com/d/msgid/grpc-io/3c54b44d-bdeb-48c3-a0c3-c804dca2ca87%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To post to this group, send email to grpc-io@googlegroups.com. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CACF4M0QcHtNnnLTo_UwPCokDJn22xdi23hMyM3-A6_m30DZOEg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.