<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>Rx Discussions Rss Feed</title><link>https://rx.codeplex.com/discussions</link><description>Rx Discussions Rss Description</description><item><title>New Post: Rx++ bug?! Catching OnNext exceptions.</title><link>https://rx.codeplex.com/discussions/430625</link><description>&lt;div style="line-height: normal;"&gt;Good discussion. I am convinced that the CreatedObserver should not be redirecting exceptions into OnError.&lt;br /&gt;
&lt;br /&gt;
Tonko, please open an Issue for this. Thanks for the help!&lt;br /&gt;
&lt;br /&gt;
Kirk&lt;br /&gt;
&lt;/div&gt;</description><author>kirkshoop</author><pubDate>Sat, 15 Jun 2013 18:02:18 GMT</pubDate><guid isPermaLink="false">New Post: Rx++ bug?! Catching OnNext exceptions. 20130615060218P</guid></item><item><title>New Post: Rx++ bug?! Catching OnNext exceptions.</title><link>http://rx.codeplex.com/discussions/430625</link><description>&lt;div style="line-height: normal;"&gt;DELETED&lt;br /&gt;
&lt;/div&gt;</description><author>davedev</author><pubDate>Tue, 11 Jun 2013 23:58:40 GMT</pubDate><guid isPermaLink="false">New Post: Rx++ bug?! Catching OnNext exceptions. 20130611115840P</guid></item><item><title>New Post: Rx++ bug?! Catching OnNext exceptions.</title><link>https://rx.codeplex.com/discussions/430625</link><description>&lt;div style="line-height: normal;"&gt;Hi Tonko, &lt;br /&gt;
&lt;br /&gt;
That's correct.&lt;br /&gt;
&lt;br /&gt;
As you mentioned, if you catch an exception thrown by an observer and do nothing with it, then you may be suppressing valuable diagnostic information and may cause corruption to user data by letting the observable continue to run in an unpredictable state.  Essentially, an operator can't possibly handle an observer's exceptions in any meaningful way since it doesn't know anything about the origin of the exception or the state of the observer.&lt;br /&gt;
&lt;br /&gt;
Developers seem to agree with the former, but sometimes they draw an incorrect conclusion with the intention of avoiding crashes: If an operator can't handle exceptions thrown by observers in any meaningful way, then simply pass the exception to &lt;strong&gt;OnError&lt;/strong&gt;.  But that's incorrect too because the &lt;strong&gt;OnError&lt;/strong&gt; handler has no way of distinguishing between exceptions thrown by the observable and exceptions thrown by the observer, thus the observer cannot handle exceptions in any meaningful way either.&lt;br /&gt;
&lt;br /&gt;
For example, imagine that an observable may throw &lt;strong&gt;FileNotFoundException&lt;/strong&gt;.  It's expected as a possibility, so you add an &lt;em&gt;onError&lt;/em&gt; handler for &lt;a href="http://davesexton.com/blog/post/Handling-Exceptions-for-Contingency.aspx" rel="nofollow"&gt;contingency&lt;/a&gt;.  Your &lt;em&gt;onError&lt;/em&gt; handler creates the missing file (if in fact it's still missing - you have to account for the implicit asynchrony in the file system) and re-subscribes to the observable.  At runtime, &lt;em&gt;onNext&lt;/em&gt; throws &lt;strong&gt;FileNotFoundException&lt;/strong&gt;, which indicates a bug in your code because you weren't aware that this exception might be thrown from within the observer; i.e., it's truly exceptional.  What's worse is that your program can't automatically recover from this exception, so the correct thing to do would be to crash; however, if the operator were to pass the observer's exception to &lt;strong&gt;OnError&lt;/strong&gt;, then instead of crashing the application goes into an infinite fail-check_file_exists-subscribe loop because it can't distinguish between a &lt;strong&gt;FileNotFoundException&lt;/strong&gt; thrown by the observable (expected) vs. one that is thrown by the observer (unexpected).  If the operator were to ignore exceptions thrown by observers instead of passing them to &lt;strong&gt;OnError&lt;/strong&gt;, then the program would crash, greatly simplifying debugging.  Furthermore, you could imagine a scenario where instead of an infinite loop the program continues executing from the &lt;em&gt;onError&lt;/em&gt; handler as if the caught exception wasn't thrown by the observer, which is now in a corrupt state.  When it comes to user data, we should always assume the worst possible scenario to avoid corruption and loss.&lt;br /&gt;
&lt;br /&gt;
Note that although the above situation may seem unlikely and we like to believe that we actually have more knowledge and control about which exceptions will be thrown by our code and the code that we call into, that excuse is actually the very reason why it's so important to catch as few exceptions as possible.  &amp;quot;Unlikely&amp;quot; is &amp;quot;exceptional&amp;quot;.  The previous scenario is entirely possible, yet unexpected.  By not catching exceptions that we possibly can't handle we avoid that scenario altogether.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br /&gt;
Given that observable operators can't handle an observer's exceptions in any meaningful way, passing the exception back to the observer may create unresolvable ambiguity, and it's the unexpected from which we have to protect user data, I conclude that it's best practice to let exceptions from user code crash the application.&lt;br /&gt;
&lt;br /&gt;
That goes not only for exceptions thrown by observers, but also exceptions thrown by &lt;em&gt;selectors&lt;/em&gt; and other user code that's passed as arguments to operators.  The difference is that user code passed as arguments to operators can in some situations be handled safely by an &lt;em&gt;onError&lt;/em&gt; handler as if the exception originated from the observable itself, though it should be clear now that the possibility of catching ambiguous exceptions also exists in this scenario.  Therefore, just because you can add an &lt;em&gt;onError&lt;/em&gt; handler doesn't necessarily mean that you should, and in general you shouldn't.&lt;br /&gt;
&lt;br /&gt;
The correct approach when defining an operator is to not catch exceptions thrown by observers at all.  Observers can add &lt;code&gt;try...catch&lt;/code&gt; blocks around code in which they expect &lt;a href="http://blogs.msdn.com/b/ericlippert/archive/2008/09/10/vexing-exceptions.aspx" rel="nofollow"&gt;vexing or exogenous&lt;/a&gt; exceptions to be thrown.  Handling these kinds of exceptions locally is the safest approach.  Truly exceptional exceptions should not be caught by observers at all, let alone caught by observables and passed back to observers!&lt;br /&gt;
&lt;br /&gt;
Here's an example subscription based on correct expectations: &lt;br /&gt;
&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
xs.Subscribe(
    value =&amp;gt;
    {
        &lt;span style="color:Blue;"&gt;try&lt;/span&gt;
        {
            parsed = Parse(value);
        }
        &lt;span style="color:Blue;"&gt;catch&lt;/span&gt; (ArgumentException ex)
        {
            Log(&lt;span style="color:#A31515;"&gt;&amp;quot;Parse failed: &amp;quot;&lt;/span&gt; + ex.ToString());

            parsed = &lt;span style="color:Blue;"&gt;new&lt;/span&gt; ParserError(ex);
        }

        OnParserStateChanged(ParserState.Updated);
    }, 
    ex =&amp;gt;
    {
        &lt;span style="color:Green;"&gt;// The observable has faulted, but if the operators we&amp;#39;ve used have been &lt;/span&gt;
        &lt;span style="color:Green;"&gt;// implemented properly, then we can be sure that any unhandled exceptions&lt;/span&gt;
        &lt;span style="color:Green;"&gt;// thrown by the Parse method above will crash the application instead of &lt;/span&gt;
        &lt;span style="color:Green;"&gt;// being passed here.&lt;/span&gt;
        Log(&lt;span style="color:#A31515;"&gt;&amp;quot;Parse observable failed: &amp;quot;&lt;/span&gt; + ex.ToString());

        OnParserStateChanged(ParserState.Faulted);
    });
&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Dave&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</description><author>davedev</author><pubDate>Tue, 11 Jun 2013 14:51:02 GMT</pubDate><guid isPermaLink="false">New Post: Rx++ bug?! Catching OnNext exceptions. 20130611025102P</guid></item><item><title>New Post: Rx++ bug?! Catching OnNext exceptions.</title><link>https://rx.codeplex.com/discussions/430625</link><description>&lt;div style="line-height: normal;"&gt;Thanks for this clarification Dave! &lt;br /&gt;
&lt;br /&gt;
Let me see if I can come up with a correct, illustrative interpretation of this part:&lt;br /&gt;
&lt;blockquote&gt;
Note: do not protect calls to Subscribe, Dispose, OnNext, OnError and OnCompleted methods. These calls are on the edge of the monad. Calling the OnError method from these places will lead to unexpected behavior&lt;br /&gt;
&lt;/blockquote&gt;
Imagine that OnNext call, after a, more or less, complex sequence of calls, ends up executing the code in some third-party, security-sensitive library.&lt;br /&gt;
&lt;br /&gt;
The writer of that library throws a specific exception on some specific input.&lt;br /&gt;
&lt;br /&gt;
The intention of the library writer is: if you read the documentation and know enough to go and catch that particular exception, it is your responsibility to handle it properly. However, if you do not know about it, your intent may be malicious and, in that case, the safest course of action is that program crashes, preventing more damage.&lt;br /&gt;
&lt;br /&gt;
Reactive Framework, if doing catch(...) of all exceptions coming out of OnNext(), interferes with that intent. While gallant in preventing the outright crash, the catch all is not expected behavior.&lt;br /&gt;
&lt;/div&gt;</description><author>Tonko</author><pubDate>Tue, 11 Jun 2013 03:51:33 GMT</pubDate><guid isPermaLink="false">New Post: Rx++ bug?! Catching OnNext exceptions. 20130611035133A</guid></item><item><title>New Post: Rx++ bug?! Catching OnNext exceptions.</title><link>https://rx.codeplex.com/discussions/430625</link><description>&lt;div style="line-height: normal;"&gt;Hi Tonko, &lt;br /&gt;
&lt;br /&gt;
§6.4 addresses user code, except standard observer callbacks.  It should probably be made clearer in the doc.&lt;br /&gt;
&lt;br /&gt;
An example would be the &lt;em&gt;selector&lt;/em&gt; function of the &lt;strong&gt;Select&lt;/strong&gt; operator.  The following is a bad implementation because it doesn't protect user code: &lt;br /&gt;
&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;static&lt;/span&gt; IObservable&amp;lt;R&amp;gt; Select&amp;lt;T, R&amp;gt;(&lt;span style="color:Blue;"&gt;this&lt;/span&gt; IObservable&amp;lt;T&amp;gt; source, Func&amp;lt;T, R&amp;gt; selector)
{
    &lt;span style="color:Blue;"&gt;return&lt;/span&gt; Observable.Create&amp;lt;R&amp;gt;(observer =&amp;gt;
    {
        &lt;span style="color:Blue;"&gt;return&lt;/span&gt; source.Subscribe(value =&amp;gt;
        {
            observer.OnNext(selector(value));
        }, 
        observer.OnError, 
        observer.OnCompleted);
    });
}
&lt;/pre&gt;&lt;/div&gt;The naïve approach would be to wrap &lt;code&gt;observer.OnNext(selector(value))&lt;/code&gt; in a &lt;code&gt;try...catch&lt;/code&gt; block, but that's incorrect as well because it catches exceptions thrown by the observer (the second paragraph that you cited).&lt;br /&gt;
&lt;br /&gt;
Here's the correct implementation: &lt;br /&gt;
&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
&lt;span style="color:Blue;"&gt;public&lt;/span&gt; &lt;span style="color:Blue;"&gt;static&lt;/span&gt; IObservable&amp;lt;R&amp;gt; Select&amp;lt;T, R&amp;gt;(&lt;span style="color:Blue;"&gt;this&lt;/span&gt; IObservable&amp;lt;T&amp;gt; source, Func&amp;lt;T, R&amp;gt; selector)
{
    &lt;span style="color:Blue;"&gt;return&lt;/span&gt; Observable.Create&amp;lt;R&amp;gt;(observer =&amp;gt;
    {
        &lt;span style="color:Blue;"&gt;return&lt;/span&gt; source.Subscribe(value =&amp;gt;
        {
            R result;
            &lt;span style="color:Blue;"&gt;try&lt;/span&gt;
            {
                result = selector(value);
            }
            &lt;span style="color:Blue;"&gt;catch&lt;/span&gt; (Exception ex)
            {
                observer.OnError(ex);
                &lt;span style="color:Blue;"&gt;return&lt;/span&gt;;
            }

            observer.OnNext(result);
        }, 
        observer.OnError, 
        observer.OnCompleted);
    });
}
&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Dave&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</description><author>davedev</author><pubDate>Mon, 10 Jun 2013 20:53:15 GMT</pubDate><guid isPermaLink="false">New Post: Rx++ bug?! Catching OnNext exceptions. 20130610085315P</guid></item><item><title>New Post: Rx++ trampoline bug?!</title><link>https://rx.codeplex.com/discussions/430668</link><description>&lt;div style="line-height: normal;"&gt;Yes, thanks!&lt;br /&gt;
&lt;/div&gt;</description><author>Tonko</author><pubDate>Mon, 10 Jun 2013 20:40:05 GMT</pubDate><guid isPermaLink="false">New Post: Rx++ trampoline bug?! 20130610084005P</guid></item><item><title>New Post: Rx++ bug?! Catching OnNext exceptions.</title><link>https://rx.codeplex.com/discussions/430625</link><description>&lt;div style="line-height: normal;"&gt;Well, according to Rx Design Guidelines pdf, protecting the user code from within an operator is ok:&lt;br /&gt;
&lt;blockquote&gt;
6.4. Protect calls to user code from within an operator&lt;br /&gt;
When user code is called from within an operator, this is potentially happening outside of the execution context of the call to the operator (asynchronously). Any exception that happens here will cause the program to terminate unexpectedly. Instead it should be fed through to the subscribed observer instance so that the exception can be dealt with by the subscribers.&lt;br /&gt;
&lt;/blockquote&gt;
However, the following paragraph is what (now) I have hard time to understand. Does it only say that you should not call OnError from within OnNext. for example? I'll try find some related discussion in old Forum:&lt;br /&gt;
&lt;blockquote&gt;
Note: do not protect calls to Subscribe, Dispose, OnNext, OnError and OnCompleted methods. These calls are on the edge of the monad. Calling the OnError method from these places will lead to unexpected behavior&lt;br /&gt;
&lt;/blockquote&gt;
&lt;/div&gt;</description><author>Tonko</author><pubDate>Mon, 10 Jun 2013 20:32:55 GMT</pubDate><guid isPermaLink="false">New Post: Rx++ bug?! Catching OnNext exceptions. 20130610083255P</guid></item><item><title>New Post: No Range() function in Ix++?</title><link>https://rx.codeplex.com/discussions/443168</link><description>&lt;div style="line-height: normal;"&gt;It did not disappear, it just hasn't been implemented yet (although I will point you to the int_range impl in the unittest for an example of how to fill in until it is available)&lt;br /&gt;
&lt;br /&gt;
Kirk&lt;br /&gt;
&lt;/div&gt;</description><author>kirkshoop</author><pubDate>Mon, 10 Jun 2013 18:30:43 GMT</pubDate><guid isPermaLink="false">New Post: No Range() function in Ix++? 20130610063043P</guid></item><item><title>New Post: lx++ groupby / aggregate</title><link>https://rx.codeplex.com/discussions/445684</link><description>&lt;div style="line-height: normal;"&gt;The thing that is wanted here is template lambdas.&lt;br /&gt;
&lt;br /&gt;
Without template lambdas the only thing a user can do is to build template functors by hand instead of using lambdas - yuck.&lt;br /&gt;
&lt;br /&gt;
What Ix++ can do is to prettify the internal names like _List_iterator to make this a little less of an eyesore.&lt;br /&gt;
&lt;br /&gt;
Kirk&lt;br /&gt;
&lt;/div&gt;</description><author>kirkshoop</author><pubDate>Mon, 10 Jun 2013 18:27:52 GMT</pubDate><guid isPermaLink="false">New Post: lx++ groupby / aggregate 20130610062752P</guid></item><item><title>New Post: Rx++ trampoline bug?!</title><link>https://rx.codeplex.com/discussions/430668</link><description>&lt;div style="line-height: normal;"&gt;Thanks for the report.&lt;br /&gt;
&lt;br /&gt;
I believe that this has been fixed.&lt;br /&gt;
&lt;br /&gt;
Kirk&lt;br /&gt;
&lt;/div&gt;</description><author>kirkshoop</author><pubDate>Mon, 10 Jun 2013 18:14:25 GMT</pubDate><guid isPermaLink="false">New Post: Rx++ trampoline bug?! 20130610061425P</guid></item><item><title>New Post: Rx++ bug?! Catching OnNext exceptions.</title><link>https://rx.codeplex.com/discussions/430625</link><description>&lt;div style="line-height: normal;"&gt;Thanks for the report.&lt;br /&gt;
&lt;br /&gt;
I think the code in CreatedObserver::OnNext is correct. When you introduce Schedulers an uncaught exception here would unwind the scheduler thread (not the callers thread) and the exception would either be swallowed or cause the process to exit.&lt;br /&gt;
&lt;br /&gt;
Passing an OnError handler to subscribe will allow the caller to handle the exception.&lt;br /&gt;
&lt;br /&gt;
Kirk&lt;br /&gt;
&lt;/div&gt;</description><author>kirkshoop</author><pubDate>Mon, 10 Jun 2013 18:12:28 GMT</pubDate><guid isPermaLink="false">New Post: Rx++ bug?! Catching OnNext exceptions. 20130610061228P</guid></item><item><title>New Post: Ix-Main Nuget Package - Silverlight 5 support</title><link>https://rx.codeplex.com/discussions/445847</link><description>&lt;div style="line-height: normal;"&gt;Would it be possible to add Silverlight 5 libraries to the Ix-Main NuGet package? As of now, there is just Net35/4/45 and SL3-WP. And the SL3 libs conflict &amp;quot;native&amp;quot; SL5 libs.&lt;br /&gt;
&lt;/div&gt;</description><author>davecz</author><pubDate>Mon, 03 Jun 2013 16:12:58 GMT</pubDate><guid isPermaLink="false">New Post: Ix-Main Nuget Package - Silverlight 5 support 20130603041258P</guid></item><item><title>New Post: lx++ groupby / aggregate</title><link>http://rx.codeplex.com/discussions/445684</link><description>&lt;div style="line-height: normal;"&gt;Hi all,&lt;br /&gt;
&lt;br /&gt;
I'm trying to use lx++ groupby in conjunction with aggregate but I couldn't come up with anything simpler than this:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;  auto ints = {1,2,3,5,6};
  auto aggrInts = from(ints)
    .groupby([](int x)
             {
               return x % 2 == 0;
             })
    .select([](const cpplinq::group&amp;lt;std::_List_iterator&amp;lt;int&amp;gt;, bool&amp;gt; &amp;amp;a)
            {
              return from(a).aggregate(std::multiplies&amp;lt;int&amp;gt;());
            })&lt;/code&gt;&lt;/pre&gt;

Can anybody think of another construction that would avoid the direct use of cpplinq::group type?&lt;br /&gt;
&lt;br /&gt;
Thanks.&lt;br /&gt;
&lt;/div&gt;</description><author>dlgd</author><pubDate>Sat, 01 Jun 2013 21:53:26 GMT</pubDate><guid isPermaLink="false">New Post: lx++ groupby / aggregate 20130601095326P</guid></item><item><title>New Post: No Range() function in Ix++?</title><link>https://rx.codeplex.com/discussions/443168</link><description>&lt;div style="line-height: normal;"&gt;Hi. I'm trying out the Ix extensions for C++, and I notice there doesn't appear to be a Range function like in .NET LINQ. e.g.:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;auto values = Range(0, 100);
auto n = from(values).where( ...etc... );&lt;/code&gt;&lt;/pre&gt;

So....where's Range gone?&lt;br /&gt;
&lt;/div&gt;</description><author>stugol</author><pubDate>Thu, 09 May 2013 21:08:35 GMT</pubDate><guid isPermaLink="false">New Post: No Range() function in Ix++? 20130509090835P</guid></item><item><title>New Post: The trouble with Where()</title><link>http://rx.codeplex.com/discussions/439717</link><description>&lt;div style="line-height: normal;"&gt;Dave, you are a gentleman and a scholar. Your suggestion is working like a charm. Not only that, my profiling shows the performance is just as good if not better than my homegrown solution where I was mapping subscribers myself.&lt;br /&gt;
&lt;br /&gt;
As for the Replay semantics, fortunately in my use case I'm not concerned with that because I'm getting an infinite and stateless upstream feed, i.e., I don't care about previous values for one particular key and I already have to wait for a new feed to come for each key anyway. So I just put the GroupBy behind a Publish/Refcount pair.&lt;br /&gt;
&lt;br /&gt;
Thanks so much!&lt;br /&gt;
&lt;/div&gt;</description><author>adhemar82</author><pubDate>Wed, 10 Apr 2013 15:42:17 GMT</pubDate><guid isPermaLink="false">New Post: The trouble with Where() 20130410034217P</guid></item><item><title>New Post: The trouble with Where()</title><link>http://rx.codeplex.com/discussions/439717</link><description>&lt;div style="line-height: normal;"&gt;Hi, &lt;br /&gt;
&lt;br /&gt;
How about using &lt;strong&gt;GroupBy&lt;/strong&gt; or &lt;strong&gt;GroupByUntil&lt;/strong&gt; with &lt;strong&gt;Publish&lt;/strong&gt;?&lt;br /&gt;
&lt;br /&gt;
For example: &lt;em&gt;(Untested)&lt;/em&gt;&lt;br /&gt;
&lt;div style="color:Black;background-color:White;"&gt;&lt;pre&gt;
IConnectableObservable&amp;lt;IGroupedObservable&amp;lt;&lt;span style="color:Blue;"&gt;string&lt;/span&gt;, Foo&amp;gt;&amp;gt; foosByBar = 
    (&lt;span style="color:Blue;"&gt;from&lt;/span&gt; foo &lt;span style="color:Blue;"&gt;in&lt;/span&gt; foos
     &lt;span style="color:Blue;"&gt;group&lt;/span&gt; foo &lt;span style="color:Blue;"&gt;by&lt;/span&gt; foo.bar)
    .Publish();

foosByBar.Where(g =&amp;gt; g.Key == &lt;span style="color:#A31515;"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;).Take(1).SelectMany(g =&amp;gt; g).Subscribe(A);
foosByBar.Where(g =&amp;gt; g.Key == &lt;span style="color:#A31515;"&gt;&amp;quot;xyz&amp;quot;&lt;/span&gt;).Take(1).SelectMany(g =&amp;gt; g).Subscribe(B);
foosByBar.Where(g =&amp;gt; g.Key == &lt;span style="color:#A31515;"&gt;&amp;quot;bla&amp;quot;&lt;/span&gt;).Take(1).SelectMany(g =&amp;gt; g).Subscribe(C);

foosByBar.Connect();
&lt;/pre&gt;&lt;/div&gt;&lt;strong&gt;GroupBy&lt;/strong&gt; uses a dictionary lookup for every key to find the appropriate observable in which the value is pushed.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Publish&lt;/strong&gt; broadcasts the group-by so that the dictionary lookup operation is shared by all observers.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Where&lt;/strong&gt; / &lt;strong&gt;Take&lt;/strong&gt; executes the predicate only once to locate the appropriate group, then it receives a broadcast of every value in that group along with any other observers interested in the same key.&lt;br /&gt;
&lt;br /&gt;
Note that &lt;strong&gt;GroupBy&lt;/strong&gt; doesn't replay &lt;strong&gt;IGroupedObservable&lt;/strong&gt; so you must set up all of your subscriptions before connecting.  If you'd rather use &lt;strong&gt;RefCount&lt;/strong&gt; than &lt;strong&gt;Connect&lt;/strong&gt;, then perhaps you should consider applying the &lt;strong&gt;Replay&lt;/strong&gt; operator to the result of &lt;strong&gt;GroupBy&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
- Dave&lt;br /&gt;
&lt;/div&gt;</description><author>davedev</author><pubDate>Wed, 10 Apr 2013 02:53:54 GMT</pubDate><guid isPermaLink="false">New Post: The trouble with Where() 20130410025354A</guid></item><item><title>New Post: The trouble with Where()</title><link>https://rx.codeplex.com/discussions/439717</link><description>&lt;div style="line-height: normal;"&gt;Do you really need separate subscribers?&lt;br /&gt;
&lt;br /&gt;
If you know all keys at compile time, then you can use one subscriber with a switch statement for it's OnNext.&lt;br /&gt;
&lt;br /&gt;
If you want to assemble a list of &amp;quot;handlers&amp;quot; at runtime, then yes, I think you may need a dictionary to make the lookup fast. But I think you can get by with one subscriber, and a concurrentdictionary. Use GetOrCreate (?) to register new handlers for each new key. You can even make a disposable which removes the handler from the dict.&lt;br /&gt;
&lt;br /&gt;
If you want to register multiple handlers, then you may need locks. Unless you're ok with key-&amp;gt;empty sticking around.&lt;br /&gt;
&lt;br /&gt;
Hope that helps.&lt;br /&gt;
&lt;/div&gt;</description><author>ngm_codeplex</author><pubDate>Wed, 10 Apr 2013 01:25:33 GMT</pubDate><guid isPermaLink="false">New Post: The trouble with Where() 20130410012533A</guid></item><item><title>New Post: The trouble with Where()</title><link>https://rx.codeplex.com/discussions/439717</link><description>&lt;div style="line-height: normal;"&gt;I love Rx, but I have a problem I keep running into.&lt;br /&gt;
&lt;br /&gt;
Let's say we have a single upstream &lt;code&gt;IObservable&amp;lt;Foo&amp;gt;&lt;/code&gt;, and N downsteam sequences attached to it, where each is only interested in those Foos that satisfy some simple predicate (say &lt;code&gt;foo.bar == someKey&lt;/code&gt;).&lt;br /&gt;
&lt;br /&gt;
Of course this is a simple job for the &lt;code&gt;Where()&lt;/code&gt; operator:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;IObservable&amp;lt;Foo&amp;gt; foos = ...;
foos.Where(foo =&amp;gt; foo.bar == &amp;quot;abc&amp;quot;).Subscribe(f =&amp;gt; A(f));
foos.Where(foo =&amp;gt; foo.bar == &amp;quot;xyz&amp;quot;).Subscribe(f =&amp;gt; B(f));
foos.Where(foo =&amp;gt; foo.bar == &amp;quot;bla&amp;quot;).Subscribe(f =&amp;gt; C(f));
...
// Many more subscriptions for different bar values.
&lt;/code&gt;&lt;/pre&gt;

What will essentially happen here is that for each &lt;code&gt;Foo&lt;/code&gt; produced upstream, the &lt;code&gt;Where()&lt;/code&gt; predicate will be evaluated for that &lt;code&gt;Foo&lt;/code&gt; N times. It acts like a linear search to find all subscribers that want this &lt;code&gt;Foo&lt;/code&gt;. That's all well and good, and exactly what we (should) expect from using &lt;code&gt;Where()&lt;/code&gt; here.&lt;br /&gt;
&lt;br /&gt;
The problem I have is that in my case, N may be very large, but the subset of subscribers that want any particular &lt;code&gt;Foo&lt;/code&gt; is very small. Typically, there will be only one for each &lt;code&gt;Foo&lt;/code&gt;. This means I'm essentially doing a slow linear search when I could be doing a very efficient lookup to find the few downstream sequences that this &lt;code&gt;Foo&lt;/code&gt; needs to be propagated too. My apps run in a very performance critical environment and I cannot afford this inefficiency.&lt;br /&gt;
&lt;br /&gt;
I've racked my brain trying to find some elegant way of doing this more efficiently, but I can only come up with solutions that involve storing a lot of state (mapping subscribers, etc) and having to manage concurrency very carefully, which defeats a lot of the purpose of using Rx in the first place. I would prefer some way of dealing with this in terms of existing operators. Has anyone dealt with this issue before, or know of a good solution? I'm happy to provide more details.&lt;br /&gt;
&lt;/div&gt;</description><author>adhemar82</author><pubDate>Wed, 10 Apr 2013 00:38:56 GMT</pubDate><guid isPermaLink="false">New Post: The trouble with Where() 20130410123856A</guid></item><item><title>New Post: IxJS on nuget</title><link>http://rx.codeplex.com/discussions/439471</link><description>&lt;div style="line-height: normal;"&gt;Hi,&lt;br /&gt;
do you plan to release ix.js and l2o.js to nuget? Would be nice to have them there.&lt;br /&gt;
&lt;/div&gt;</description><author>DGolubets</author><pubDate>Mon, 08 Apr 2013 08:28:57 GMT</pubDate><guid isPermaLink="false">New Post: IxJS on nuget 20130408082857A</guid></item><item><title>New Post: Inconsistent API?</title><link>http://rx.codeplex.com/discussions/438498</link><description>&lt;div style="line-height: normal;"&gt;Hi, &lt;br /&gt;
&lt;br /&gt;
Take a look at &lt;a href="http://channel9.msdn.com/Blogs/J.Van.Gogh/Rx-API-in-depth-Hot-and-Cold-observables" rel="nofollow"&gt;this video about hot and cold observables&lt;/a&gt;.  There's also a section named &lt;a href="http://msdn.microsoft.com/en-us/library/hh242977(v=vs.103).aspx" rel="nofollow"&gt;Cold vs. Hot Observables&lt;/a&gt; in the official documentation.&lt;br /&gt;
&lt;br /&gt;
.NET events are &lt;em&gt;hot&lt;/em&gt;.  Adding a handler does not cause any side-effects.  The handler is not called until the next event is raised.  Events that were raised before you added a handler are not seen by the handler.&lt;br /&gt;
&lt;br /&gt;
Converting an event to an observable preserves this behavior.  Subscribing to a &lt;em&gt;hot&lt;/em&gt; observable does not cause any side-effects.  The observer is not called until the next notification.  Previous notifications that were pushed before you subscribed are not seen by your observer.&lt;br /&gt;
&lt;br /&gt;
If you want to gather all notifications in memory and replay them to all subscribers, then you can apply the &lt;a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.replay(v=vs.103).aspx" rel="nofollow"&gt;Replay&lt;/a&gt; operator.&lt;br /&gt;
&lt;br /&gt;
-Dave&lt;br /&gt;
&lt;/div&gt;</description><author>davedev</author><pubDate>Sat, 30 Mar 2013 14:23:18 GMT</pubDate><guid isPermaLink="false">New Post: Inconsistent API? 20130330022318P</guid></item></channel></rss>