Skip to content
· 26 min watch
Ian Griffiths By Ian Griffiths Technical Fellow I

Ian Griffiths discusses Rx.NET v6.1 release, upcoming packaging changes in v7.0 and the impact of .NET 10 at .NET Conf 2025.

About this talk

.NET Conf 2025

Ian Griffiths, Technical Fellow at endjin, shares the latest updates on the Reactive Extensions for .NET (AKA ReactiveX AKA Rx.NET). Learn about the new features in Rx 6.1, what .NET 10 means for the project, and the significant packaging changes coming in Rx v7.0 that finally solve the long-standing deployment bloat issue.

In this talk:

  • Rx 6.1 New Features: DisposeWith operator for fluent CompositeDisposable usage, new TakeUntil overload with cancellation token support, and ResetExceptionDispatchState operator
  • The Bloat Problem Explained: Why self-contained Windows deployments were pulling in 90MB of unnecessary WPF and Windows Forms assemblies
  • Rx 7 Preview: How the new packaging model fixes bloat while maintaining source and binary compatibility
  • Community Contributions: Features from Chris Pullman (ReactiveUI), Neils Berger, Daniel Weber, and Adam Jones
  • Async Rx .NET: Status update and plans for a non-alpha release

Read the transcript

Rx.NET in brief: a declarative model for responding to events

Hi! Thanks for listening to this talk about what's been happening lately with the Reactive Extensions for .NET and what we've got planned. My name's Ian Griffiths. I'm a technical fellow at endjin, and my employer endjin maintains the Reactive Extensions for .NET. You can find the source code in this repo on GitHub.

If you're listening to this talk, it's likely that you already know about the Reactive Extensions, or as we usually call them, just Rx. But just in case you don't, here's a very quick introduction. Rx is an event-driven programming model. It's useful in any application where things happen. It provides a functional declarative programming style for writing code that responds to events.

This model has become popular in other programming languages, especially JavaScript, but it was originally a .NET technology invented by Microsoft. Rx .NET was one of the first projects that Microsoft open sourced, one of the first to come under .NET Foundation ownership, and it's been a community-supported project for over a decade now.

Talk overview and Rx.NET history since 2023

Today I'm gonna talk about things that have been, things that are, and some things that have not yet come to pass. More specifically, I'll talk about Rx 6.1, our most recent release. I'll also talk about what .NET 10 means for Rx and also for the related Ix project that lives in the same repository.

There's a new feature in the .NET 10 runtime class libraries that has a significant impact on us. And finally, I'll talk about our progress towards the next release, Rx version 7.0. To put this all in context, it's useful to know the recent history of Rx. endjin took over maintenance at the start of 2023.

This was a little over two years since there had last been a version since Rx five. The project had ground to a halt because its previous maintainers were no longer able to devote much time to it. Our first job was to bring the codebase back into line with current tooling, 'cause it had fallen behind and wasn't actually able to build on the current version of Visual Studio.

So we addressed that and then went on to add tests for newer versions of .NET, and then produced a new release, Rx version six. We spent a big chunk of the next year bringing the documentation up to date in the form of the free online ebook, Intro to Rx. We also spent a lot of time working out how best to solve a problem that I'll be talking about later, because that work will not ship until Rx 7.0.

Three community-driven features in Rx 6.1

So there wasn't a lot of visible progress. We had a couple of minor bug fix releases, but it wasn't until last month that we produced a release with any new features. And that's what I want to talk about first: Rx version 6.1, which shipped in October 2025. We've bumped the minor version number because there are three new features in Rx 6.1.

All of these arose from community input. Two were written by community members, and the third was based on community suggestions. So we have a new DisposeWith operator, which enables a fluent programming style when working with the CompositeDisposable type. This comes from Chris Pullman, a major contributor to the ReactiveUI project, and this extension fits in well with common coding idioms in that world.

Demo: DisposeWith in a ReactiveUI WPF search app

To show how this works, I've got a program here based on one of the ReactiveUI examples. It's a very simple front end, and I can type search terms in here and it finds packages for me. This happens to be a WPF app, and as you can see, the main window here has this text box for me to type into and a list box that shows the result.

The basic idea with ReactiveUI is that we can represent user input as Rx observable streams, and we can also direct the output of observable streams into user interface elements. This code here is the basic logic for handling search input, and it's mostly standard Rx operators. This first method is from ReactiveUI and it lets me get an observable stream representing input to my textbox.

We're then using Rx's Throttle to ensure we don't perform searches too often while the user types, and this Where clause filters out empty inputs. And ultimately this delivers results into another property. And so that's one of the basic ideas of the ReactiveUI library. It uses Rx to define how information flows through the application.

Now if we look at the actual main window, this is where the code that you just saw gets hooked up to the user interface elements. You can see that this connects the application logic's search term input to the actual text box, and this connects the search logic's output to an actual list box. And this code here is where the new feature that we've added in Rx 6.1 comes in useful.

UI elements get created and torn down all the time. Entries in the search results, for example, appear when I type things and get replaced when I type something else. So each time some new UI opens up, not only do we need to run this sort of code to connect everything up, we also need to be ready to shut it all down cleanly. To enable that, this WhenActivated method passes me this argument, which uses Rx's CompositeDisposable type. Now that's been in Rx for years and it's just a collection of IDisposable objects, the idea being that they can all be disposed at once when needed. Any disposable objects I put in here will automatically be disposed when this user interface element goes away.

Right now I'm just calling Add to add things to that CompositeDisposable, and that's okay, but it's not quite the normal style for a ReactiveUI app. Normally we chain method calls together one after another in what's often called the fluent style. And if I show you another UI element, the one for an individual search result, you can see it's using that CompositeDisposable slightly differently.

Instead of wrapping each of these setup lines in a call to Add, I've got just one more fluent invocation on the end of it with this DisposeWith method. It's a small change, but it enables teardown to be handled slightly more neatly. And that's Rx 6.1's new DisposeWith feature.

A TakeUntil overload that accepts a cancellation token

We also have a new overload of the TakeUntil operator.

This comes from Neils Berger and incorporates feedback from Daniel Weber, both members of the Rx community. Existing overloads enable a sequence to be observed until either an element matches some criteria or some other observable source completes. But this now enables a cancellation token to signal the instant at which the sequence should complete.

ResetExceptionDispatchState and growing async stack traces

Finally, we have a new operator called ResetExceptionDispatchState, developed in response to feedback from Adam Jones, and this one is best shown by example. Rx has always offered this Throw operator. When you subscribe to the observable it returns, it immediately calls OnError, passing this exception. Since we construct just a single exception, it will reuse it for each subscription.

Normally that's not a problem, but there's one situation in which this can produce surprising behavior. But before I show you that situation, I want to demonstrate something about exceptions that has nothing to do with Rx and which you might not be aware of. I've got a different program here that creates a single exception object, and then each time around this loop, we wrap that in a task and await the task. That await will, of course, throw the exception, and this C# catch block just displays it. But watch what happens when I run this. Each time around the loop, my stack trace gets longer and longer. This is a feature of how the .NET runtime throws asynchronous exceptions. Each throw appends the current location to the stack trace, and normally that's what we want.

If an exception has traveled through multiple await statements before reaching a catch block, we want the stack trace to reflect that whole history, which is why the asynchronous rethrow appends new information to the existing stack trace. But this mechanism assumes that when the error occurred, something did actually use a normal throw operation. If you're reusing exception objects, it's the throw statement that resets any stack trace information that was previously in the exception. So when you write code like this, where there's no throw statement and it's nothing but asynchronous rethrows of the same exception object, you get these ever-growing stack traces. So that's a feature of .NET itself, and it's by design.

So back in the Rx code, we've broken a rule here. If you're going to reuse an exception object, you should perform a real throw each time you want to use it. Well, what does that mean for Rx? Well, normally in Rx, we never actually throw exceptions. When an observable source wants to report an error, it passes an exception object to its subscriber's OnError method. This means that exceptions in Rx typically don't have stack traces at all.

However, look at this code here. I'm using the await keyword on an Rx observable. I'm using a feature of Rx that effectively bridges between Rx's world of observable streams and more ordinary imperative async programming. When you await an observable, it's usually because you expect the source to produce a single element, and that element will be the result of this await. But if the source calls OnError instead, this await will throw the exception. And because it's an await, it will use the .NET runtime support for rethrowing exceptions in asynchronous operations. And as you've just seen, using that repeatedly on the same exception without ever performing a real throw causes stack traces to get longer and longer. So when I run this, I get that same behavior.

Obviously, this isn't exactly an Rx problem, because you already saw this behavior in the code that didn't use Rx at all. But remember, the root cause of this is rethrowing the same exception multiple times without ever executing a real throw. And as I said, in normal Rx use, we never actually throw exceptions. So if we use this await machinery, we're quite likely to run into this problem.

This issue was originally presented as a bug report. We did consider modifying Rx so that it always performs a real throw in this scenario to reset the stack trace. But the problem with that is that there are situations where an exception supplied to Rx did actually have useful information in its stack trace, and this behavior of appending additional details is exactly what we want. So the problem is that in general, Rx has no way of knowing whether an exception object should be reset or whether it has valuable information that should be preserved. And that's why we've added this new operator in Rx 6.1. If you have an observable that you know will be producing the same exception repeatedly, and you know you will be using await like this to receive the exception, you can insert a call to ResetExceptionDispatchState. This operator just passes normal notifications through unmodified, but if an error passes through it, it performs an actual throw operation to reset the exception stack trace and then passes it on. So if I run this again, we no longer get an ever-growing stack trace.

What .NET 10 means for Rx.NET

Now let's look at what .NET 10 means for Rx. We've added .NET 10 to the test suite for Rx 6.1. As it happens, we did not need to make any modifications to get things working, so you won't see a new release with a .NET 10 target. Any further Rx v6 releases will continue to provide the same targets as always, with net6.0 being the latest TFM. And although .NET 6 has been out of support for a while, the .NET 8, 9, and 10 runtimes all support running code with a net6.0 target. So you can use the current version of Rx on .NET 10 today. At the moment, we don't have any new features planned that would depend on .NET 10. So even when we ship Rx 7, we won't necessarily provide a net10.0 target, but we would of course support running on .NET 10.

Ix.NET, System.Linq.Async and LINQ for IAsyncEnumerable in .NET 10

However, .NET 10 has meant we've had to change something else. The .NET reactive repo is home not just to the Rx.NET project, but also to a related project called Ix.NET, the Interactive Extensions for .NET. These emerged because Rx defines an extended set of LINQ operators. As well as providing most of the standard operators you get with other LINQ providers, it defines some of its own, and the Interactive Extensions provided implementations of these for ordinary IEnumerable<T>. Essentially, Ix.NET expanded the features available on ordinary collections to match the features available in Rx.NET. But it then went on to introduce a new interface called IAsyncEnumerable<T> and an associated LINQ implementation.

Now, a few years later, that interface was eventually moved into the .NET runtime libraries, but .NET did not supply a corresponding LINQ implementation. Since the Ix.NET library had always offered LINQ to IAsyncEnumerable, its System.Linq.Async library became the de facto async LINQ to Objects. The problem is that this library never had any official support from Microsoft. Bug reports and feature requests come into the Rx repository, mostly from people who assume that this is a Microsoft library and that they can expect the same kind of support as is available for the .NET runtime library features. But in practice, nobody at all was working on this for about two years. And then when endjin offered to take over maintenance of Rx back in 2023, we effectively became responsible for this other project. Nobody pays us for any of this, and it's just me working part-time, so we really didn't have the capacity to maintain System.Linq.Async as well as Rx.NET.

Fortunately, Microsoft offered to build this functionality into the .NET runtime library as a fully supported feature, making the existing System.Linq.Async library from the reactive repo redundant. This is great, because everyone now gets a fully supported, high-quality implementation of LINQ for IAsyncEnumerable. It's built into .NET 10, but it's also available to older runtimes via a new NuGet package. And that's great for us, because we can now focus on Rx.NET.

Demo: upgrading System.Linq.Async to avoid ambiguous calls on .NET 10

But there was one issue. We had to make sure that anyone using System.Linq.Async has a smooth transition to its .NET 10 replacement. If we'd done nothing at all, it would have caused havoc, because any library or application using our old System.Linq.Async package would suddenly find that there were two competing implementations in scope. This would cause the compiler to report errors about ambiguous extension methods. So we've produced a new version of System.Linq.Async that just defers to the new .NET 10 one. It has required some technical trickery to ensure backwards compatibility, but the goal is that anyone using this library who sees errors because it conflicts with .NET 10's new feature can just remove the System.Linq.Async library completely, or they can upgrade to the latest version and the errors will go away.

Just to show this in practice, I've got a very simple console application here that uses System.Linq.Async. It's this line here, the call to Where, that's using that library. Right now, this targets .NET 8. But if I modify the project to target .NET 10, you can see that now I've got an error complaining that this call is ambiguous. The C# compiler doesn't know whether I mean the old implementation in System.Linq.Async or the new one built into .NET 10. But if I upgrade to the latest System.Linq.Async, this problem goes away. Since this talk is pre-recorded, this package is actually still in preview, because it depends on a .NET 10 package that is also in preview. But by the time you're watching this, a proper release should be available, and we will also be marking it as obsolete at some point. You can see that we no longer get the ambiguous method error. Also, if I set this back down to .NET 8, it still compiles, but now this will actually be using Microsoft's implementation. If you use our legacy System.Linq.Async package, then when you upgrade to the latest version, it actually adds a transitive reference to its new replacement from the .NET 10 runtime libraries, because that package supports older runtimes.

Rx 7.0: minor breaking changes and the bloat fix

Now, I'd like to talk about what's coming next: what will be happening in Rx version 7. There was briefly a time when Rx tried to align its version numbering with .NET. Rx 5 happened to ship at the same time as .NET 5, and back then the plan seemed to be to offer a new major Rx release with each new version of .NET. But that was just before the two years of complete inactivity, and when we took over, we felt that we should release major versions only when there was a need to do so.

So what would require us to move from version 6 to 7? Well, there's one major problem we're intending to fix with this release. If you've listened to my talks at the last two .NET Confs, you'll know this isn't the first time I've talked about this, but we believe we finally have a good solution. And it's the problem in which self-contained deployments of applications targeting Windows end up being tens of megabytes larger than necessary if they use Rx. We will also be taking this opportunity to make it clear that we no longer support versions of .NET that themselves are out of support, so we will raise the minimum .NET target framework from net6.0 to net8.0.

And finally, there are a few changes that are minor, but which are technically breaking changes that have been waiting for the next major release. So we made a small change to nullability handling of the OfType operator to align it with some other LINQ implementations. And there are some behaviors that we consider to be unintended and where we think the fix will align with how people expect things to work, but technically it's a breaking change. And finally, we're gonna stop producing new versions of the old compatibility facades that were introduced in Rx version four.

Why does Rx add WPF and Windows Forms to self-contained apps?

But the big one is the fix for the bloat issues. We are going to introduce a significant change in Rx .NET packaging. It will only affect people building UI applications on Windows, though. I've got a console application with a Windows-specific target framework. It needs that because it invokes certain Windows APIs. The Program.cs here, I'm using the network availability API provided by WinRT, and I've wrapped it using Rx to provide a stream of notifications when the computer loses or acquires network connections. That's a Windows-specific API, but this is just a console app.

So this illustrates that just because you specified a Windows target framework, it doesn't necessarily mean you are building a classic desktop application with a user interface. But look at this build output folder. Now, I've configured this project to use self-contained deployment, meaning that it brings its own copy of the .NET runtime and any other components that it needs to run.

This application can be installed by simply copying this entire folder to the target machine. It does not need the .NET runtime to be pre-installed, but it's huge. Now part of that is simply that the .NET runtime is quite large, but that's not the whole story. This is much bigger than a self-contained console app would normally be.

Looking more closely, we see these PresentationFramework components. These are part of WPF, one of the Windows desktop frameworks that .NET offers. And a little further down, we can see that the other one, Windows Forms, is here too. These two UI frameworks are adding about 90 megabytes to the size of this folder.

We can mitigate this a little by enabling trimming. That will make the whole folder a great deal smaller, but even so, it ends up being many megabytes larger than it would've been if these UI frameworks weren't here. So why are they here? It's because of the unfortunate consequences of a design decision made back in Rx version four.

This decision is known as "the great unification," and it took us through a world in which Rx consisted of multiple components in which it was kind of unclear what they all did, and even more unclear which ones were required in which situations, and it took us into a world where there's exactly one component: System.Reactive. And at the time, this was great, but the decision to include UI framework support as part of this great unification has turned out to be problematic. The effect is that if you build an application with a target in which Windows Forms and WPF are available, Rx will provide its Windows Forms and WPF support, and that's a problem because to do that, it adds an implicit reference to the desktop UI framework, meaning that self-contained deployments get a copy of these UI frameworks even if the application itself isn't actually using them.

Demo: upgrading to the Rx 7.0 preview removes the bloat

I'm now gonna upgrade this project to a preview build of Rx version 7.0 and rebuild it. Now the project appears to work exactly as before, and our goal is that for anyone who wasn't building WPF, Windows Forms, or UWP applications, that it all carries on working exactly as before.

So if you weren't running into this bloat issue, or perhaps because you weren't using self-contained deployment, then this shouldn't really affect you. But this example does use it, so let's look at the output folder. This is now much smaller. This is almost exactly the same size as a simple Hello World application, made slightly larger just by the presence of the System.Reactive assembly, but those PresentationFramework and Windows Forms assemblies are gone.

Upgrading a WPF app: the Rx 7.0 analyzer and new package

So you can see that the main effect has been achieved, but this has consequences for applications that actually are using the UI framework features. So here I've got a WPF project that is using Rx six, and this line of code here is using a WPF-specific feature. Specifically, this ensures that any events that emerge from this observable are delivered via the correct thread for this window.

I'm now gonna try upgrading this to Rx 7.0.

Now I've got compiler errors. To enable Windows projects to use Rx without being forced to have a dependency on the desktop UI frameworks, we've had to hide the relevant types. They are still actually present at runtime to ensure binary compatibility, but they are effectively invisible at build time. I could spend well over an hour explaining why this was the least bad available solution to the problem, but we don't have time for that in this particular talk. Anyway, notice that in addition to the error, we've got this diagnostic. Now we've added a code analyzer to Rx 7.0 that detects this exact situation and tells you what you need to do to fix it.

We've done this because we know people will get this error when they upgrade and it isn't entirely obvious what to do about it. So the analyzer tells me that I need to add a reference to the new System.Reactive.WPF NuGet package. So let's go back and find that. And when I add this, I'm back in business.

So this provides source-level compatibility as long as you add the new package reference. And as I mentioned, we do actually provide binary-level compatibility by using a trick with reference assemblies to hide these types just at build time. So the need to add a new package is slightly annoying, but our view is that UI framework-specific support should really always have been an opt-in feature.

Why has the packaging fix taken so long?

So this gets us finally to the place where we want to be. Now you might be wondering why it's taken so long to get here. I've been talking about this for two years now. We first opened a GitHub discussion on this back in November 2023, and we did produce a prototype just a few months later to show what it would look like in the hope of getting some feedback.

Now, we didn't get a lot, so we announced in October 2024 that we were gonna move forward, but that did produce some negative community feedback. The plan we had at the time was somewhat more radical and would've been more disruptive. Its end state would've avoided the weird trick we've had to use with reference assemblies.

And it would also have enabled us finally to remove the UAP target framework from the main Rx package. But it would also have created a lot of problems for people who weren't actually affected by the issue we were trying to fix. So we had a rethink and came up with a new plan. The critical difference is that now System.Reactive remains as the main assembly, meaning that a lot of Rx users shouldn't even notice this change.

We also introduced an extensive set of tests designed to find the kind of subtle problems that emerge with any attempt to fix this issue. We called that test suite "Rx Gauntlet," and that is what's given us the confidence to move forward with this new plan.

Async Rx.NET: progress and hopes for a non-alpha release

One last thing: last year I talked about Async Rx .NET. We have made a little progress on extending the test suite, but we considered the code bloat issue with Rx .NET to be of higher priority. We will be getting back to Async Rx .NET, and we hope to have a non-alpha release next year.

My name's Ian Griffiths. Thanks for listening.

About the presenter

Ian Griffiths

Technical Fellow I

Ian Griffiths

Ian has worked across an extraordinary breadth of computing - from embedded real-time systems and broadcast television to medical imaging and cloud-scale architectures. As Technical Fellow at endjin, he brings this deep cross-domain experience to bear on the hardest technical problems.

A 17-time Microsoft MVP in Developer Technologies, Ian is the author of O'Reilly's Programming C# 12.0 and one of the foremost authorities on the C# language and high-performance .NET development. He's a maintainer of Reactive Extensions for .NET, Reaqtor, and endjin's 50+ open source projects.

Ian has created Pluralsight courses on WPF fundamentals, WPF advanced topics, WPF v4, and the TPL, and has given over 20 talks at conferences worldwide. Technology brings him joy.