Observable.Publish with rethrow behaviour
<p>I have a cold Observable that might <code>OnError</code> when it is subscribed to. How can i  create a cold Observable, that returns a single element (an object that receives as a dependency the source Observable), or propagates the <code>OnError</code> of the source.
Using the <code>Publish</code> operator, the <code>onError</code> handler it is not called.</p>

<pre><code>Private Shared Sub Test()
    Dim source = Observable.Throw(Of Integer)(New Exception)
    ' Dim source = Observable.Range(0, 9)

    Dim obs = source.Publish(Function(published)
                                 Return Observable.
                                        Return(New ObjectThatConsumesXs(published))
                             End Function)

    obs.Subscribe(Sub(a)

                  End Sub,
                  Sub(ex)

                  End Sub,
                  Sub()

                  End Sub)
End Sub


Private Class ObjectThatConsumesXs
    Private _subscription As IDisposable

    Public Sub New(source As IObservable(Of Integer))
        _subscription = source.Subscribe(Sub(x)

                                         End Sub,
                                         Sub(ex)

                                         End Sub,
                                         Sub()

                                         End Sub)
    End Sub
End Class
</code></pre>

<p>EDIT:</p>

<p>This is going to be somehow a long description.</p>

<p>I have a device that is essentially a <a href="https://en.wikipedia.org/wiki/CAN_bus" rel="nofollow">CAN Bus</a> scanner. This device has a serial port, and upon receiving a Start command it starts mirroring whatever messages it captures on the CAN Bus until it receives a Stop command. The replied messages are wrapped in a variant of <a href="https://en.wikipedia.org/wiki/Point-to-Point_Protocol" rel="nofollow">PPP Protocol</a> to mitigate errors, given the fact that the serial port baud-rate is about 1MBaud.</p>

<p>I want to design a desktop application that connects to the scanner, sends commands to it, and receives the captured CAN messages. It should display the received messages in a ListBox/ListView, with the ability to live filter what is displayed by some criteria. It should also group by IDs embedded in each message, and display a list with encountered ID's and their total occurence. It should also display a total of distinct ID's, and a total count of messages. </p>

<p>What is received between a Start and a Stop command is a collection of messages that represent a record. The application should be capable to record multiple times in a session and must provide a way to persist records on disk along with applied filters, a user defined name, etc. The same application should be capable to import those records for offline analysis.</p>

<p>The fore mentioned ObjectThatConsumesXs is my record, that exposes it's contained messages as an Observable that reply to its subscribers(Reply operator).</p>

<p>I am using ReactiveUI - MVVM/WinForms/Reactive Extensions, and among others i have managed to design a service that exposes a <code>GetRecordUntil</code> function that returns an <code>IObservable(Of Record)</code>. Upon subscription the observable emits a single Record that is updated with messages received from the scanner.</p>

<p>I am opened to suggestion regarding the design of the application. But i am afraid that my question should be at least re-tagged if not even renamed.</p>