Rx Question: Why Observable.Subscribe(OnNext, OnError, OnCompleted) did not reach to OnError ???
-
1 august 2012 03:08
I have the following code, but I don't understand why it didn't print out the exception message to the console or it didn't reach to the OnError method. Would you please help!
Thanks
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reactive.Linq; namespace UsingSubcribe { class Program { static void Main(string[] args) { //make an array of numbers var numbers = from number in new int[] { 1, 2, 0, 3 } select 10/number; //make an observable sequence out of those numbers var observable = numbers.ToObservable(); //use the ObservableExtention.Subscribe to callbacks observable.Subscribe(OnNext, OnError, OnCompleted); Console.ReadLine(); } //Call each time a value from the observable sequence is processed static void OnNext(int number) { Console.WriteLine(number); } //Call if the processing of the observable sequence throw exceptions static void OnError(Exception exception) { Console.WriteLine(@"Oops ""{0}""", exception.Message); } //Call if all values in the observable sequence have been processed static void OnCompleted() { Console.WriteLine("I'm done!"); } } }
- Mutat de Papy Normand 1 august 2012 17:07 not relared to SQL Server Data Access (From:SQL Server Data Access)
Toate mesajele
-
1 august 2012 17:04
Hello,
Your question seems to be relative to Rx , but there is a forum dedicated to Rx
http://social.msdn.microsoft.com/Forums/en-US/rx/threads
I will move your thread towards this forum which is not easy to find .It belongs to the Data Platform development
http://social.msdn.microsoft.com/Forums/en-US/category/dataplatformdev
Have a nice day
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.
-
1 august 2012 17:09
Hello,
Move done.
I hope you will find a quick and full solution to your problem in this forum
Have a nice day
PS : you have asked the same question ( answered 3 hours ago ) in
Please, avoid to ask the same question on several forums : a moderator has to do a move to send your thread in the good forum and now another moderator will have to do a merge...
The moves/merges are usual for moderators but , in this case , it is annoying because a moderator will have to a merge to avoid to let a thread dying...
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.
- Editat de Papy Normand 1 august 2012 17:14 PS added
- Propus ca răspuns de Dave Sexton 1 august 2012 17:45
- Marcat ca răspuns de Bart De Smet [MSFT]Owner 1 august 2012 18:18