Questions tagged [rx.net]

The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators.

The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using LINQ operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, Rx = Observables + LINQ + Schedulers.

Resources:

264 questions
3
votes
2 answers

How should I model circular dependencies in FRP (Rx.Net)?

I am trying to learn more about functional-reactive programming by using Rx.Net to implement Tic-Tac-Toe. The problem I am having is that there seems to be a circular dependency in my game-logic. The commands stream (PlaceToken, ResetGame, etc.)…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
3
votes
1 answer

How do I turn an IObservable> into an IObservable>?

I have a stream for the state of the left mouse button: var leftMouseButton = mouse.Select(x => x.LeftButton).DistinctUntilChanged(); I then Window this to give me an observable of observables representing drags of the mouse: var leftMouseDrag =…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
3
votes
2 answers

C# Reactive Extensions - Iterate through items of IObservable>

I've started to play around with the rx version of C# recently and am wondering how it's possible to solve the following problem: I'm using refit to get a list of items from a server via: [Get("/items")] IObservable> GetItems(); I would…
tobi_b
  • 1,218
  • 1
  • 12
  • 21
3
votes
2 answers

How to get latest changed events of IObservable>?

My system has a lot of status objects - connections status, cpu load, logged users and so on. All of such events are merged into a single observable stream. I want to make a admin utility to show actual status of the system and to show all of that…
Dmitrii
  • 321
  • 6
  • 17
2
votes
3 answers

In Rx.NET, how do I make a Subject to resemble TaskCompletionSource behavior?

In Rx.NET, how do I make a Subject to resemble TaskCompletionSource.Task behavior? It needs to cache and reply the first event, even if completed. Neither AsyncSubject nor ReplaySubject(bufferSize: 1) would do that. For example (let's call it…
noseratio
  • 59,932
  • 34
  • 208
  • 486
2
votes
1 answer

How to plug a cancellation token into a ReactiveX stream (IObservable) before publishing it?

How to plug a cancellation token into an existing IObservable pipeline before calling Publish on it (i.e., before it becomes an IConnectableObservable)? This must be a part of a cold observable pipeline, before subscribing to it (otherwise, I could…
noseratio
  • 59,932
  • 34
  • 208
  • 486
2
votes
1 answer

In Rx, is it a responsibility of the consumer (IObserver) to deal with thread safety?

In ReactiveX paradigm, Is it a responsibility of the consumer (IObserver) to deal with thread safety? E.g., if OnCompleted call comes along when OnNext is still executing on another thread? It looks like it from Rx .NET sources but the docs are…
noseratio
  • 59,932
  • 34
  • 208
  • 486
2
votes
1 answer

Catch exception from rx.net Observable.FromAsync

I have the following Reactive Extensions Subject and need to log exceptions, and also shutdown this potentially blocking async task created on Observable.FromAsync cleanly. In relation to this and on cancelling the token, the exception…
morleyc
  • 2,169
  • 10
  • 48
  • 108
2
votes
0 answers

FromEventPattern -> Throttle -> Dispatcher.Invoke -> UI freeze

Occasionally, my current application freezes. With Visual Studio attached, I pause debugging and observe the current threads and their call stack. I find two or more Threads that wait for another. I am not sure if it is a real deadlock, for the last…
sa.he
  • 1,391
  • 12
  • 25
2
votes
1 answer

Executing Task based methods in Observable chain => IObservable>

I have a lot of code that is reactive but needs to call into Task based methods. For example, in this snippet PracticeIdChanged is an IObservable. When PracticeIdChanged fires, I want the system to react by reloading some stuff and have code that…
user1221237
  • 138
  • 8
2
votes
2 answers

Merge hot source1 with a cold source2

source1 emits A,B,C,D etc and never completes source2 emit 1,2 and completes I want to merge to A1, B2, C1, D2 etc update my initial attemp was to Zip and Repeat as suggested from Theodor however this creates a lock cause source2 generation is…
Apostolis Bekiaris
  • 2,145
  • 2
  • 18
  • 21
2
votes
2 answers

Why Observable.ToEnumerable() does not produce values until underlying sequence completes?

Running the following code foreach(var i in Observable .Range(1, 3) .Do(Console.WriteLine) .ToEnumerable()) Console.WriteLine("Fin:" + i); I'm getting this output: 1 2 3 Fin:1 Fin:2 Fin:3 The question is -…
Oleg Dok
  • 21,109
  • 4
  • 45
  • 54
2
votes
1 answer

Reactive Extensions: how to sample the latest value from IGroupedObservable

I have the following unit test where I am trying to group objects from a source observable by their identifier and sample them every 50 ticks. However, the code with the GroupBy, SelectMany -> Sample gives a different output than the expected…
Vincent Rutten
  • 333
  • 1
  • 2
  • 8
2
votes
1 answer

How to create an observable that signals the completion of two other observables?

I have two IObservable, and want to create a IObservable (or some sort of ISingle, if such a thing exists) that emits a completion signal when both complete, and nothing else. What's the idiomatic way to do this in Rx.NET? I'm used to…
jack
  • 147
  • 1
  • 7
2
votes
3 answers

Rx.net implement retry functionality on disconnect/error in observable

Below is the following code: public class FooService { private ITransportService _transportService; public FooService(ITransportService transportService) { _transportService = transportService; …
ThomasBecker
  • 388
  • 6
  • 20