You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, thanks again for your wonderful library! 8)
Describe the bug
I was starting to make use of BufferIf to speed up my initial loading of an ObservableCollectionExtended w/o needing to insert on the original in batches.
I ran into a few issues:
The compiler complained about ambiguous calls when trying to use BufferIf. I fixed this by changing some of the optional parameters to required in order to make the method signatures unique with just a pause observable as input. (I'd be happy to set up a Pull request /w these changes)
BufferIf then displayed similar behavior to BatchIf race condition #98 where the resulting ChangeSet contents would be wiped to zero when crossing over an ObserveOn boundary.
Given a certain code setup which I'll outline later, I was able to get a null ref on Line 86 of ListEx.Clone. This seems to just be a different manifestation of the issue above.
Steps To Reproduce
I cloned the DynamicData repo to commit d6c660b. I then made the BufferIf API changes outlined above.
Then I wrote this code in a fresh .NET 4.7.2 WPF project:
public partial class MainWindow : Window
{
public ObservableCollectionExtended<string> OutputDisplay { get; } = new ObservableCollectionExtended<string>();
public SourceList<string> Output { get; } = new SourceList<string>();
public CompositeDisposable CompositeDisposable = new CompositeDisposable();
private BehaviorSubject<bool> pause = new BehaviorSubject<bool>(false);
public MainWindow()
{
InitializeComponent();
this.Output.Connect()
.BufferIf(pause)
.Do(l =>
{
System.Console.WriteLine($"Count is: {l.Count}");
})
.ObserveOn(RxApp.MainThreadScheduler)
.Do(l =>
{
System.Console.WriteLine($"Count is: {l.Count}");
})
.Bind(this.OutputDisplay)
.Subscribe()
.DisposeWith(this.CompositeDisposable);
// Null Ref outlined in 3rd point if this is uncommented:
//this.Output.Add("Test Item");
this.pause.OnNext(true);
for (int i = 0; i < 100000; i++)
{
this.Output.Add(i.ToString());
}
this.pause.OnNext(false);
}
}
Expected behavior
I expected to see two logging lines to the output, both with 100000 printed. Instead, the log line after the ObserveOn call is zero. And the resulting OutputDisplay contents is also empty.
If the commented out line is added, I would've expected "Test Item" to be on my OutputDisplay list and/or for it to be wiped out and replaced by the Bind() call. I'd have to do more research to know the expected outcome. Either way, adding this line resulted in a null reference in the Bind -> Adapt -> Clone stack trace, where one of the Change items ended up being null. Looking closer, there was a ChangeSet /w zero items that had somehow fired a null item for the foreach loop on line 76 of ListEx.
All of this seems to be related to a similar bug to #98 , but that's just my gut feeling.
Screenshots
Screenshot of the buffered results being cleared over an ObserveOn boundary
Null ref if "Test Item" line is uncommented. Might not trigger for you /w different hardware, if it happens to be a race condition issue.
First off, thanks again for your wonderful library! 8)
Describe the bug
I was starting to make use of BufferIf to speed up my initial loading of an ObservableCollectionExtended w/o needing to insert on the original in batches.
I ran into a few issues:
The compiler complained about ambiguous calls when trying to use BufferIf. I fixed this by changing some of the optional parameters to required in order to make the method signatures unique with just a pause observable as input. (I'd be happy to set up a Pull request /w these changes)
BufferIf then displayed similar behavior to BatchIf race condition #98 where the resulting ChangeSet contents would be wiped to zero when crossing over an ObserveOn boundary.
Given a certain code setup which I'll outline later, I was able to get a null ref on Line 86 of ListEx.Clone. This seems to just be a different manifestation of the issue above.
Steps To Reproduce
I cloned the DynamicData repo to commit d6c660b. I then made the BufferIf API changes outlined above.
Then I wrote this code in a fresh .NET 4.7.2 WPF project:
Expected behavior
I expected to see two logging lines to the output, both with 100000 printed. Instead, the log line after the ObserveOn call is zero. And the resulting OutputDisplay contents is also empty.
If the commented out line is added, I would've expected "Test Item" to be on my OutputDisplay list and/or for it to be wiped out and replaced by the Bind() call. I'd have to do more research to know the expected outcome. Either way, adding this line resulted in a null reference in the Bind -> Adapt -> Clone stack trace, where one of the Change items ended up being null. Looking closer, there was a ChangeSet /w zero items that had somehow fired a null item for the foreach loop on line 76 of ListEx.
All of this seems to be related to a similar bug to #98 , but that's just my gut feeling.
Screenshots

Screenshot of the buffered results being cleared over an ObserveOn boundary
Null ref if "Test Item" line is uncommented. Might not trigger for you /w different hardware, if it happens to be a race condition issue.

Environment