Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Rx.NET v6.0: Enhancing Compatibility, Trimming Support, and Many More

Rx.NET v6.0: Enhancing Compatibility, Trimming Support, and Many More

At the end of last month, the team behind Reactive Extensions for .NET announced the release of Rx.NET major version 6.0. The latest version of the library brings several improvements and aligns itself with the current .NET ecosystem. The original announcement blog post reveals that this update doesn't introduce significant new functionality, it focuses on enhancing compatibility, supporting the latest versions of .NET, and addressing common pain points for developers.

The first notable change is that Rx.NET 6.0 now extends its support to the current versions of .NET, including .NET 6.0 and .NET 7.0. Previously, although Rx 5.0 was compatible with these versions, it lacked explicit targeting for them, which caused confusion among potential users. In response, the Rx team removed support for out-of-date frameworks and added the net6.0 target, aligning with Microsoft's supported platforms.

Based on the report, it is important to take note that even though the System.Reactive NuGet package doesn't include a net7.0 target, it fully supports .NET 7.0. The note that the absence of a specific target doesn't imply a lack of support, as stated in the announcement blog post:

Any package that targets net6.0 will run on .NET 7.0. In fact it's perfectly valid for a NuGet package to specify targets corresponding to out-of-support versions of .NET, because current .NET runtimes support packages that target older versions. For example, a package targeting netcore3.1 will run on .NET 7.0 even though .NET Core 3.1 went out of support some time ago.

To improve trimming capabilities, Rx.NET 6.0 introduces trimmability annotations in the net6.0 target. Trimming allows for reducing the size of the System.Reactive.dll component with results in smaller application sizes and improved startup performance. By leveraging these annotations, developers observed significant reductions in the size of the library, making trimming a valuable feature for certain deployment scenarios.

In terms of new features, Rx 6.0 incorporates enhancements to handle unhandled exceptions from wrapped Tasks. Applications can now opt to swallow these failures silently, which can be useful in specific scenarios where exceptions occur after the application code has unsubscribed. While swallowing exceptions is generally discouraged, the Rx library handles this situation to maintain compatibility and support edge cases where it can't be avoided.

Additionally, the public availability of the SingleAssignmentDisposableValue class is another notable change. Previously this class was marked as internal, but this type is now accessible, bringing it in line with other disposable types in the library. Its inclusion provides increased flexibility to developers who require this functionality.

As reported, the Rx.NET team has invested significant effort in aligning the codebase with the current .NET tooling. This ensures that the library builds seamlessly on modern versions of Visual Studio and the .NET SDK. As part of these updates, the unit tests have been transitioned from XUnit to MSTest to address limitations with running tests on UWP. MSTest provides better support for UWP, a platform that Rx has been catering to for a long time.

Looking ahead, the Rx team has outlined their roadmap for version 7.0, primarily focusing on resolving code bloat issues in UI frameworks. The plan involves extracting UI-framework-specific functionality into separate packages to avoid unnecessary dependencies and reduce application size. By decoupling Windows Forms, WPF, and UWP code from the main System.Reactive component, Rx.NET will enable more efficient integration with various UI frameworks and reduce the overall footprint of applications.

Lastly, Rx.NET 6.0 represents a step forward in ensuring compatibility, improving trimming capabilities, and laying the groundwork for future enhancements. The team is actively addressing open issues and working on comprehensive documentation to aid developers in understanding and utilizing Rx effectively. With a commitment to supporting the latest .NET ecosystem and addressing user feedback. The future roadmap and project progress can be followed on the official GitHub repository.

About the Author

Rate this Article