Skip to content

feat(observable-events): add provider-aware event generator - #150

Merged
glennawatson merged 4 commits into
mainfrom
CP_add-observable-events
Aug 15, 2026
Merged

glennawatson merged 4 commits into
mainfrom
CP_add-observable-events

Conversation

@ChrisPulman

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

A new provider-aware incremental source generator package for exposing .NET events as strongly typed observables, with documentation and compatibility tests.

What is the new behavior?

  • Adds ReactiveUI.Primitives.ObservableEvents as an analyzer-only netstandard2.0 package.
  • Generates instance event wrappers from Events() calls and static event observables through GenerateStaticEventObservablesAttribute.
  • Selects lean ReactiveUI.Primitives, ReactiveUI.Primitives.Reactive, or standalone System.Reactive APIs from the consuming compilation without adding a runtime dependency.
  • Supports void, Task, and ValueTask event delegates, inherited events, generic/nested hosts, and collision-safe generated names.
  • Adds real framework compilation tests for WPF, WinForms, Avalonia, and MAUI events, plus lean/reactive async leaf compatibility.
  • Records RXOE001 through RXOE003 in AnalyzerReleases.Shipped.md for release 7.2.0. AnalyzerReleases.Unshipped.md contains only #nullable enable; the project excludes that marker from Roslyn's Markdown release parser while continuing to validate the shipped table.

What is the current behavior?

There is no ObservableEvents analyzer package in this repository, so consumers must adapt .NET events manually or depend on a separate generator that is tied to System.Reactive APIs.

Checklist

  • Tests have been added or updated (for bug fixes / features)
  • Docs have been added or updated (for bug fixes / features)
  • Changes target the main branch
  • PR title follows Conventional Commits

Additional information

Validation completed locally:

  • Release generator build: 0 warnings, 0 errors.
  • TUnit/Microsoft Testing Platform: 31/31 tests passed on net10.0-windows.
  • Generator coverage: 100% lines (413/413) and 100% branches (222/222).
  • NuGet inspection: analyzer DLL only under analyzers/dotnet/cs, with no runtime dependency group.
  • Full .NET 11/mobile solution validation is left to CI because the local SDK does not provide those workloads.

Generator:
- add incremental instance and static event observable generation
- select lean Primitives, Reactive Primitives, or standalone System.Reactive from consumer references
- ship RXOE001-RXOE003 release metadata for 7.2.0

Compatibility:
- cover WPF, WinForms, Avalonia, MAUI, and async event delegates
- document package installation, payload mapping, and static generation
- wire the analyzer and tests into the solution

Testing:
- add TUnit Roslyn compilation coverage for provider, generic, collision, platform, and async cases
- retain 100 percent line and branch coverage for the generator
@ChrisPulman
ChrisPulman marked this pull request as ready for review August 12, 2026 22:52
Dependencies:
- Bind the analyzer to System.Collections.Immutable 9.0.0, the Roslyn 4.14 minimum.
- Keep the dependency private so the analyzer-only package remains dependency-free.

Validation:
- Pass the net9 ObservableEvents TUnit suite.
- Preserve 100% generator line and branch coverage.
@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.14%. Comparing base (1c307c1) to head (bba322c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #150      +/-   ##
==========================================
+ Coverage   98.10%   98.14%   +0.03%     
==========================================
  Files         678      679       +1     
  Lines       21004    21417     +413     
  Branches     2533     2619      +86     
==========================================
+ Hits        20606    21019     +413     
  Misses        197      197              
  Partials      201      201              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud

Copy link
Copy Markdown

@glennawatson
glennawatson merged commit 9681ccc into main Aug 15, 2026
13 checks passed
@glennawatson
glennawatson deleted the CP_add-observable-events branch August 15, 2026 08:03
@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants