r3-reactive-extensions

Build reactive event-driven C# pipelines with the R3 library for .NET.

1.1k|101|Updated Nov 12, 2025
One-click install
npx skills add https://github.com/Aaronontheweb/dotnet-skills --skill r3-reactive-extensions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: r3-reactive-extensions
Source: https://github.com/Aaronontheweb/dotnet-skills/tree/main/skills/r3-reactive-extensions
Command: npx skills add https://github.com/Aaronontheweb/dotnet-skills --skill r3-reactive-extensions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Composing event streams in C# with System.Reactive (Rx.NET) suffers from subscriptions silently dying on exceptions, heavy IScheduler abstractions, and hard-to-find subscription leaks. This Skill teaches R3, Cysharp's modern reimplementation of Reactive Extensions, so you can build resilient push-based pipelines with a corrected error contract and testable scheduling.

Core Features & Use Cases

  • Resilient error handling: Errors route to OnErrorResume without terminating the subscription, with OnErrorResumeAsFailure and Catch for classic terminate-and-recover semantics.
  • Explicit async dispatch: Async operators like SubscribeAwait and SelectAwait take an AwaitOperation mode (Sequential, Drop, Switch, Parallel) for latest-wins search, debounced submit, and ordered processing.
  • Testable scheduling and concurrency: TimeProvider and FrameProvider replace IScheduler, with FakeTimeProvider and FakeFrameProvider enabling deterministic tests, plus Synchronize and SynchronizedReactiveProperty for multi-threaded producers.
  • Use Case: Implement search-as-you-type by debouncing text changes with Debounce, cancelling stale requests via AwaitOperation.Switch, and bridging results to Task or IAsyncEnumerable.

Quick Start

Ask the assistant to build an R3 pipeline that debounces a search text property by 300 milliseconds and calls an async API with latest-wins cancellation.

Frequently Asked Questions about r3-reactive-extensions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate from System.Reactive (Rx.NET) to R3?

Replace IObservable<T> with Observable<T>, split OnError handling into OnErrorResume or OnErrorResumeAsFailure, rename Throttle to Debounce and Buffer to Chunk, convert single-value operators to awaitable *Async methods, and swap IScheduler for TimeProvider. The skill includes a ten-step migration checklist.

What is the difference between R3 and Rx.NET error handling?

In Rx.NET an exception calls OnError and permanently unsubscribes the stream. In R3 exceptions flow to OnErrorResume and the subscription stays alive; termination only happens via OnCompleted carrying a Result. Add OnErrorResumeAsFailure to restore terminate-on-error behavior.

How do I handle async operations in an R3 stream?

Use async operators like SubscribeAwait, SelectAwait, and WhereAwait with an AwaitOperation mode. Switch cancels the in-flight operation for latest-wins scenarios, Sequential queues work in order, Drop ignores arrivals while busy, and Parallel runs all concurrently.

Is R3 safe to use with multiple threads publishing events?

No, R3 does not serialize concurrent producers and operators are not internally locked, so concurrent OnNext calls corrupt downstream state. Add Synchronize() or an ObserveOn operator after the source, or use SynchronizedReactiveProperty for shared state.

When should I not use R3 for a C# pipeline?

Avoid R3 for request/response I/O, where async/await fits better, and for producer/consumer pipelines needing backpressure, where System.Threading.Channels or Akka.NET Streams are appropriate. R3 is push-based with no backpressure.

How do I test time-based R3 operators without real delays?

Pass a FakeTimeProvider from Microsoft.Extensions.TimeProvider.Testing to time operators and advance virtual time, or use R3's FakeFrameProvider for frame-based operators. Combine with ToLiveList() to capture emissions and assert on them deterministically.