ReactiveUI.SourceGenerators 1.0.3

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package ReactiveUI.SourceGenerators --version 1.0.3
                    
NuGet\Install-Package ReactiveUI.SourceGenerators -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ReactiveUI.SourceGenerators" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ReactiveUI.SourceGenerators" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="ReactiveUI.SourceGenerators" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ReactiveUI.SourceGenerators --version 1.0.3
                    
#r "nuget: ReactiveUI.SourceGenerators, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ReactiveUI.SourceGenerators@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ReactiveUI.SourceGenerators&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=ReactiveUI.SourceGenerators&version=1.0.3
                    
Install as a Cake Tool

ReactiveUI.SourceGenerators

Use source generators to generate ReactiveUI objects.

Not taking public contributions at this time

These Source Generators were designed to work in full with ReactiveUI V19.5.31 and newer supporting all features, currently:

  • [Reactive]
  • [ObservableAsProperty]
  • [ReactiveCommand]

Versions older than V19.5.31 to this:

  • [Reactive] fully supported,
  • [ObservableAsProperty] fully supported,
  • [ReactiveCommand] all supported except Cancellation Token asnyc methods.

Historical ways

Read-write properties

Typically properties are declared like this:

private string _name;
public string Name 
{
    get => _name;
    set => this.RaiseAndSetIfChanged(ref _name, value);
}

Before these Source Generators were avaliable we used ReactiveUI.Fody. With ReactiveUI.Fody the [Reactive] Attribute was placed on a Public Property with Auto get / set properties, the generated code from the Source Generator and the Injected code using Fody are very similar with the exception of the Attributes.

[Reactive]
public string Name { get; set; }

ObservableAsPropertyHelper properties

Similarly, to declare output properties, the code looks like this:

public partial class MyReactiveClass : ReactiveObject
{
    ObservableAsPropertyHelper<string> _firstName;

    public MyReactiveClass()
    {
        _firstName = firstNameObservable
            .ToProperty(this, x => x.FirstName);
    }

    public string FirstName => _firstName.Value;

    private IObservable<string> firstNameObservable() => Observable.Return("Test");
}

With ReactiveUI.Fody, you can simply declare a read-only property using the [ObservableAsProperty] attribute, using either option of the two options shown below.

[ObservableAsProperty]
public string FirstName { get; }

Welcome to a new way - Source Generators

Usage Reactive property [Reactive]

using ReactiveUI.SourceGenerators;

public partial class MyReactiveClass : ReactiveObject
{
    [Reactive]
    private string _myProperty;
}

Usage ObservableAsPropertyHelper [ObservableAsProperty]

using ReactiveUI.SourceGenerators;

public partial class MyReactiveClass : ReactiveObject
{
    [ObservableAsProperty]
    private string _myProperty;
}

Usage ReactiveCommand [ReactiveCommand]

Usage ReactiveCommand without parameter

using ReactiveUI.SourceGenerators;

public partial class MyReactiveClass
{
    public MyReactiveClass()
    {
        InitializeCommands();
    }

    [ReactiveCommand]
    private void Execute() { }
}

Usage ReactiveCommand with parameter

using ReactiveUI.SourceGenerators;

public partial class MyReactiveClass
{
    public MyReactiveClass()
    {
        InitializeCommands();
    }

    [ReactiveCommand]
    private void Execute(string parameter) { }
}

Usage ReactiveCommand with parameter and return value

using ReactiveUI.SourceGenerators;

public partial class MyReactiveClass
{
    public MyReactiveClass()
    {
        InitializeCommands();
    }

    [ReactiveCommand]
    private string Execute(string parameter) => parameter;
}

Usage ReactiveCommand with parameter and async return value

using ReactiveUI.SourceGenerators;

public partial class MyReactiveClass
{
    public MyReactiveClass()
    {
        InitializeCommands();
    }

    [ReactiveCommand]
    private async Task<string> Execute(string parameter) => await Task.FromResult(parameter);
}

Usage ReactiveCommand with IObservable return value

using ReactiveUI.SourceGenerators;

public partial class MyReactiveClass
{
    public MyReactiveClass()
    {
        InitializeCommands();
    }

    [ReactiveCommand]
    private IObservable<string> Execute(string parameter) => Observable.Return(parameter);
}

Usage ReactiveCommand with CancellationToken

using ReactiveUI.SourceGenerators;

public partial class MyReactiveClass
{
    public MyReactiveClass()
    {
        InitializeCommands();
    }

    [ReactiveCommand]
    private async Task Execute(CancellationToken token) => await Task.Delay(1000, token);
}

Usage ReactiveCommand with CancellationToken and parameter

using ReactiveUI.SourceGenerators;

public partial class MyReactiveClass
{
    public MyReactiveClass()
    {
        InitializeCommands();
    }

    [ReactiveCommand]
    private async Task<string> Execute(string parameter, CancellationToken token)
    {
        await Task.Delay(1000, token);
        return parameter;
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (61)

Showing the top 5 NuGet packages that depend on ReactiveUI.SourceGenerators:

Package Downloads
ReactiveUI

A MVVM framework that integrates with the Reactive Extensions for .NET to create elegant, testable User Interfaces that run on any mobile or desktop platform. This is the base package with the base platform implementations

ReactiveUI.WPF

Contains the ReactiveUI platform specific extensions for Windows Presentation Foundation (WPF)

ReactiveUI.Testing

Provides extensions for testing ReactiveUI based applications

ReactiveUI.Blazor

Contains the ReactiveUI platform specific extensions for Blazor

ReactiveUI.Maui

Contains the ReactiveUI platform specific extensions for Microsoft Maui

GitHub repositories (15)

Showing the top 15 popular GitHub repositories that depend on ReactiveUI.SourceGenerators:

Repository Stars
timschneeb/GalaxyBudsClient
Unofficial Galaxy Buds Manager for Windows, macOS, Linux, and Android
HMBSbige/NatTypeTester
测试当前网络的 NAT 类型(STUN)
reactiveui/Akavache
An asynchronous, persistent key-value store for .NET desktop and mobile applications, backed by SQLite. Suited to both durable data such as user settings and cached data that expires, with optional encryption and System.Text.Json serialization.
TEdit/Terraria-Map-Editor
TEdit - Terraria Map Editor - TEdit is a stand alone, open source map editor for Terraria. It lets you edit maps just like (almost) paint! It also lets you change world settings (time, bosses downed etc), edit chests and change sign, make epic dungeons, castles, cities, and add rewards for your adventurers!
wieslawsoltes/Dock
A docking layout system.
database64128/youtube-dl-wpf
WPF GUI for youtube-dl and yt-dlp.
LibUsbDotNet/LibUsbDotNet
My updates to LibUsbDotNet, an excellent library for cross-platform USB device control using Mono/.NET
PhantomGamers/SFP
This utility is designed to allow you to apply skins to the modern Steam client
AvaloniaCommunity/Avalonia.Markup.Declarative
Provides helpers for declarative ui in C#
Monitor221hz/Pandora-Behaviour-Engine-Plus
Patcher for behavior, character, and skeleton project files for Skyrim Special Edition.
OpenHarmony-NET/OpenHarmony.Avalonia
reactiveui/ReactiveUI.Validation
Reactive validation for ReactiveUI view models. Declare validation rules as observables over properties and bind the results to views on any supported .NET platform.
mcodersir/dicodePing
A VPN client that offers free servers and one-click connection.
mysteryx93/HanumanInstitute.MvvmDialogs
Simplifies dialogs access from view models when using MVVM in .NET
reactiveui/ReactiveMvvm
A sample application showing one set of ReactiveUI view models shared across many .NET UI frameworks. Includes front ends for Avalonia, .NET MAUI, WPF, Windows Forms, Blazor and Terminal.Gui.
Version Downloads Last Updated
7.1.0 13,501 11/21/2026
7.0.0 267 11/21/2026
6.0.0 1,322 11/18/2026
5.1.0 940 11/17/2026
5.0.0 23,086 11/15/2026
4.2.0 225,622 9/26/2026
4.1.0 744 9/26/2026
4.0.1 730 9/26/2026
4.0.0 869 9/26/2026
3.2.0 127,813 8/1/2026
3.1.0 76,764 6/4/2026
3.0.0 2,475 6/3/2026
2.6.1 102,988 1/12/2026
2.5.1 43,911 10/24/2025
2.4.1 20,211 9/2/2025
2.3.1 19,295 6/29/2025
2.2.4 9,993 6/1/2025
2.1.27 18,108 3/16/2025
1.0.3 22,324 7/19/2024
Loading failed