Skip to content

fix(primitives): support nullable SubscribeSafe static calls#106

Merged
glennawatson merged 3 commits into
mainfrom
CP_subscribe-safe-nullable-static
Jun 28, 2026
Merged

fix(primitives): support nullable SubscribeSafe static calls#106
glennawatson merged 3 commits into
mainfrom
CP_subscribe-safe-nullable-static

Conversation

@ChrisPulman

@ChrisPulman ChrisPulman commented Jun 28, 2026

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Bug fix for SubscribeSafe overload resolution when consumers call LinqExtensions.SubscribeSafe(...) statically with nullable observable element types.

What is the new behavior?

SubscribeSafe can be used from both ReactiveUI.Primitives and ReactiveUI.Primitives.Reactive in fluent extension style and static alias style for nullable and non-nullable sources, including IObservable<object?>, IObservable<string?>, and IObservable<int?>.

The fix adds nullable-source static-call overloads, keeps the existing Action<T> extension signatures for non-nullable consumers, and tracks the new public API entries in PublicAPI.Unshipped.txt across target frameworks.

Closes #103

What is the current behavior?

Static alias calls such as PrimitivesLinqExtensions.SubscribeSafe(source, OnNext, SubscriptionErrors.Throw) can bind to the extension-block generated static member and fail with CS8714 when source is IObservable<object?> or another nullable T.

Checklist

  • I have read the Contribute guide
  • 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 run:

  • dotnet test "tests/ReactiveUI.Primitives.Tests/ReactiveUI.Primitives.Tests.csproj" -- --treenode-filter "/*/*/RxNamesTests/*SubscribeSafe*" --output Detailed
  • dotnet test "tests/ReactiveUI.Primitives.Reactive.Tests/ReactiveUI.Primitives.Reactive.Tests.csproj" -- --treenode-filter "/*/*/LinqExtensionsTests/*SubscribeSafe*" --output Detailed
  • Broader affected suites and targeted package builds were also run before commit: RxNamesTests, ReactiveUI.Primitives.Reactive.Tests, net462, net10.0-android, and net10.0-ios package builds for both package variants.

## Changes

- Add nullable-source static SubscribeSafe overloads for ReactiveUI.Primitives and ReactiveUI.Primitives.Reactive shared source.

- Preserve existing Action<T> fluent extension signatures for non-nullable consumers.

- Add an OverloadResolutionPriority polyfill for target frameworks that need the compiler-recognized attribute.

- Track the new overloads in PublicAPI.Unshipped baselines across package TFMs.

## Tests

- Add TUnit coverage for fluent nullable, static nullable reference, static nullable value type, and static non-nullable reference SubscribeSafe use.

- Verified focused SubscribeSafe tests, RxNamesTests, Reactive tests, net462, Android, and iOS package builds before commit.
@ChrisPulman ChrisPulman marked this pull request as ready for review June 28, 2026 12:26
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #106      +/-   ##
==========================================
- Coverage   90.93%   90.89%   -0.05%     
==========================================
  Files         651      651              
  Lines       20464    20478      +14     
  Branches     2454     2459       +5     
==========================================
+ Hits        18609    18613       +4     
- Misses       1486     1492       +6     
- Partials      369      373       +4     

☔ 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.

Add TUnit coverage for the nullable static SubscribeSafe overload families that Codecov reported as uncovered.

Cover observer, completion callback, error-only, and terminal completion overloads for both ReactiveUI.Primitives and ReactiveUI.Primitives.Reactive test projects.
@sonarqubecloud

Copy link
Copy Markdown

@glennawatson glennawatson merged commit 01bcc34 into main Jun 28, 2026
12 of 13 checks passed
@glennawatson glennawatson deleted the CP_subscribe-safe-nullable-static branch June 28, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Conflicting PrimitivesR3BridgeGeneratorAttribute when using InternalsVisibleTo + TreatWarningsAsErrors

2 participants