Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,21 @@ public partial class MyReactiveClass : ReactiveObject
}
```

### Usage Reactive property with other source generators

Roslyn source generators don’t have a defined run order and each generator sees the same initial compilation.
Code/attributes that one generator emits aren’t visible to other generators in the same compilation round,
so adding `[JsonPropertyName]`/`[JsonInclude]` from `ReactiveUI.SourceGenerators` won’t cause the `System.Text.Json`
source generator to pick them up in that project. That’s by design of the generator pipeline (no inter-generator dependencies / ordering).

So `System.Text.Json` needs special care. In the case that you want to Json-serialize `[Reactive]`
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'Json-serialize' to 'JSON-serialize' for consistency with standard JSON abbreviation capitalization.

Suggested change
So `System.Text.Json` needs special care. In the case that you want to Json-serialize `[Reactive]`
So `System.Text.Json` needs special care. In the case that you want to JSON-serialize `[Reactive]`

Copilot uses AI. Check for mistakes.
properties, and you want to use the `System.Text.Json` source generator they must run in different
assemblies. The same applies to other source generators depending on the output of `ReactiveUI.SourceGenerators`.

Define types with `[Reactive]` properties in assembly `A`, and then define the
`System.Text.Json.JsonSerializerContext` source generation context in assembly `B`, and let
`B` reference `A`.

## Usage ObservableAsPropertyHelper `[ObservableAsProperty]`

ObservableAsPropertyHelper is used to create a read-only property from an IObservable. The generated code will create a backing field and a property that returns the value of the backing field. The backing field is initialized with the value of the IObservable when the class is instantiated.
Expand Down
Loading