fix(primitives): support nullable SubscribeSafe static calls#106
Merged
Conversation
## 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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
glennawatson
approved these changes
Jun 28, 2026
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What kind of change does this PR introduce?
Bug fix for
SubscribeSafeoverload resolution when consumers callLinqExtensions.SubscribeSafe(...)statically with nullable observable element types.What is the new behavior?
SubscribeSafecan be used from bothReactiveUI.PrimitivesandReactiveUI.Primitives.Reactivein fluent extension style and static alias style for nullable and non-nullable sources, includingIObservable<object?>,IObservable<string?>, andIObservable<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 inPublicAPI.Unshipped.txtacross 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 withCS8714whensourceisIObservable<object?>or another nullableT.Checklist
Additional information
Validation run:
dotnet test "tests/ReactiveUI.Primitives.Tests/ReactiveUI.Primitives.Tests.csproj" -- --treenode-filter "/*/*/RxNamesTests/*SubscribeSafe*" --output Detaileddotnet test "tests/ReactiveUI.Primitives.Reactive.Tests/ReactiveUI.Primitives.Reactive.Tests.csproj" -- --treenode-filter "/*/*/LinqExtensionsTests/*SubscribeSafe*" --output DetailedRxNamesTests,ReactiveUI.Primitives.Reactive.Tests,net462,net10.0-android, andnet10.0-iospackage builds for both package variants.