Repository navigation
fix(operators): route callback faults to OnError - #248
Merged
Merged
Conversation
- Route non-fatal user callback exceptions in Scan, Aggregate, Do, DistinctUntilChanged, and DistinctUntilChangedBy to OnError. - Mark faulted operators stopped and dispose their upstream subscriptions on live and synchronous sequence paths. - Propagate notification-context disposal across chained async witnesses and stop coordinators. Cross-thread teardown inside an active notification deadlocks without this flag. - Rewrite the DebounceUntil immediate-emission test to verify immediate delivery with ManualTimeProvider. - Remove unused and transitive NuGet package entries and update dependencies to current releases. Closes #241
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #248 +/- ##
=======================================
Coverage 99.98% 99.98%
=======================================
Files 1012 1012
Lines 27139 27207 +68
Branches 3259 3279 +20
=======================================
+ Hits 27135 27203 +68
Misses 4 4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
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.



Summary
This PR routes non-fatal user callback exceptions to downstream
OnErroracross the remaining synchronous unary operators, fixes cross-thread disposal deadlocks in chained async witnesses and stop coordinators, and cleans up transitive NuGet package entries while updating dependencies.Scan/Fold,Aggregate/Reduce,Do/Tap,DistinctUntilChanged/Unique, andDistinctUntilChangedBy/UniqueBycatch non-fatal callback exceptions, forward them toOnError, latch stopped state, and dispose upstream subscriptions across both live witnesses and synchronous sequence fast paths.WitnessAsync,WitnessAsyncState,DisposableAsyncSlot,SingleAssignmentDisposableAsync, and the async stop coordinators propagate notification-context disposal to upstream subscriptions during in-flight notifications and completion teardown.ParityOperatorTests.WhenDebounceUntil_WithConditionTrue_ThenEmitsImmediatelyusesManualTimeProviderto verify immediate bypass emission without advancing time.TUnit,Microsoft.WindowsAppSDK,Microsoft.Extensions.TimeProvider.Testing(banded per target framework), and the.NET FrameworkBCL polyfill packages to their latest releases.Why
User delegates passed to
Scan,Aggregate,Do,DistinctUntilChanged(comparer), andDistinctUntilChangedBythrew exceptions back to the upstream producer instead of forwardingOnErrorto the downstream observer and disposing the subscription. Downstream observer exceptions still propagate to the producer after upstream disposal.Closes #241
In CI run 44742883594,
DebounceUntil(...).Take(1).FirstAsync()hung until the 15-minute runner timeout. When a downstream async witness hopped threads while cancelling its disposal token source and disposed its upstream subscription from inside an active notification,MarkDisposingFromNotificationdid not propagate to upstream witnesses or stop coordinators. The upstream witness saw an active call owned by the original thread and waited forever on its own in-flight notification.Breaking changes
None
How this was verified
Added unit tests covering callback faults, fatal exception passthrough, downstream observer exception propagation, and cross-thread chained async witness and coordinator teardown, verified 100% line and branch coverage across all touched files, and ran
nuget-cleanup,nuget-outdated, anddetect-duplicatesacrosssrc/.Notes for the reviewer
WitnessAsync.cs,WitnessAsyncState.cs,DisposableAsyncSlot.cs, andAsyncStopCoordinator{T,TOther}.csfor the async notification-disposal propagation fix. BothDisposeFromNotificationAsyncand terminalOnCompletedAsyncteardown propagate notification context to upstreamIWitnessStatesubscriptions so chained operators never wait on their own caller.UnaryWitnessDelivery.csandDirectSequenceEmission.cshold the shared synchronous delivery and sequence fast-path guards. The updates toFoldWitness,ReduceWitness,TapWitness,TapSignal,UniqueWitness,UniqueSignal,UniqueByWitness, andUniqueBySignalwire those operators into the shared helpers and are mechanical to review.TapWitnessforwarding members carry[MethodImpl(MethodImplOptions.AggressiveInlining)]in theReactiveUI.Primitives.Corepublic API baselines.Microsoft.Extensions.TimeProvider.Testingis banded inside<Choose>(11.0.0onnet11.0,10.11.1onnet10.0), andObservableEventspreserves its explicitMicrosoft.CodeAnalysis.CSharp4.8.0generator baseline.Checklist