Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: OnCompleted never fires v7.9.* #635

Closed
marmy28 opened this issue Aug 29, 2022 · 3 comments · Fixed by #771
Closed

[Bug]: OnCompleted never fires v7.9.* #635

marmy28 opened this issue Aug 29, 2022 · 3 comments · Fixed by #771
Labels

Comments

@marmy28
Copy link

marmy28 commented Aug 29, 2022

Describe the bug 🐞

I used similar code as the below step with DynamicData v7.8.6. I updated to 7.9.14 and OnCompleted subscription stopped firing.

Step to reproduce

// Arrange
using var disposable = new CompositeDisposable();
var publishedObservable = Observable.Create(o =>
{
o.OnNext(1);
o.OnCompleted();
return Disposable.Empty;
})
.ToObservableChangeSet(i => i)
.Publish();
var hasCompleted = false;

// Act
var d = publishedObservable
.Subscribe(
_ => { },
_ => { },
() => { hasCompleted = true; });
disposable.Add(publishedObservable.Connect());
disposable.Add(d);

// Assert
Assert.IsTrue(hasCompleted);

Reproduction repository

No response

Expected behavior

With v7.8.6 this unit test passes. With v7.9.1 and above OnCompleted never triggers in the subscribe.

Screenshots 🖼️

No response

IDE

Visual Studio 2022

Operating system

Windows

Version

10

Device

Laptop

DynamicData Version

7.9.14

Additional information ℹ️

No response

@marmy28 marmy28 added the bug label Aug 29, 2022
@RolandPheasant
Copy link
Collaborator

Thanks for letting my know. I will take a look as soon as I can.

@JakenVeina
Copy link
Collaborator

The core problem is that the internal .Subscribe() call that subscribes to the source supplies an onNext and onError handler, but just ignores onCompleted notifications. That's easy enough to fix for the trivial scenario, we just need to pass along observer.OnCompleted, but when expiration or size-limit parameters are applied, we actually don't WANT to complete the downstream, when the upstream completes, we want to keep it open until any outstanding remove operations finish. I tried a couple things, but I'm not seeing a clean way to do this with the current implementation.

Unless there's any objections, I'm going to work on enhancing the test coverage for this operator, which currently consists of only one test, and then once that's accepted and merged, re-write the operator from scratch, as there's also opportunity for performance improvement at the same time.

JakenVeina added a commit to JakenVeina/DynamicData that referenced this issue Nov 20, 2023
…increasting code coverage from 69% to 100% across the internal implementation classes.

Identified existing defects within the `.ToObservableChangeSet()` operators, mostly related to error and completion propagation, and implemented testing for this behavior, with the tests being marked as "Skip" until the defects are fixed. This also includes the defect referred in reactivemarbles#635.

Added an `IsCompleted` flag to `ChangeSetAggregator<T>`, to allow for testing of completion propagation.
RolandPheasant pushed a commit that referenced this issue Nov 20, 2023
* Rebuilt test fixtures for both `.ToObservableChangeSet()` operators, increasting code coverage from 69% to 100% across the internal implementation classes.

Identified existing defects within the `.ToObservableChangeSet()` operators, mostly related to error and completion propagation, and implemented testing for this behavior, with the tests being marked as "Skip" until the defects are fixed. This also includes the defect referred in #635.

Added an `IsCompleted` flag to `ChangeSetAggregator<T>`, to allow for testing of completion propagation.

* Added benchmarks for `.ToObservableChangeSet()` operators.
JakenVeina added a commit to JakenVeina/DynamicData that referenced this issue Dec 3, 2023
…nd lists, for better independence, proper error handling, and improved performance. Resolves reactivemarbles#635.
JakenVeina added a commit to JakenVeina/DynamicData that referenced this issue Dec 3, 2023
…nd lists, for better independence, proper error handling, and improved performance. Resolves reactivemarbles#635.
JakenVeina added a commit to JakenVeina/DynamicData that referenced this issue Dec 5, 2023
…nd lists, for better independence, proper error handling, and improved performance. Resolves reactivemarbles#635.
JakenVeina added a commit to JakenVeina/DynamicData that referenced this issue Dec 6, 2023
…nd lists, for better independence, proper error handling, and improved performance. Resolves reactivemarbles#635.
glennawatson pushed a commit that referenced this issue Dec 6, 2023
* Re-designed the `.ToObservableChangeSet()` operator for both caches and lists, for better independence, proper error handling, and improved performance. Resolves #635.

* Code Format updates

* Formatting/Organization

* Updated `.ToObservableChangeSet()` implementations to leverage C#11 features.

---------

Co-authored-by: Chris Pulman <[email protected]>
Copy link

This issue 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 Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants