Skip to content

Commit

Permalink
Merge pull request #1049 from akarnokd/DelaySelectorFix
Browse files Browse the repository at this point in the history
Fix Delay(selector) NPE on immediate emissions
  • Loading branch information
Oren Novotny committed Sep 28, 2019
2 parents 24fb6e7 + 4c1ac31 commit c3602a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Rx.NET/Source/src/System.Reactive/Linq/Observable/Delay.cs
Expand Up @@ -657,7 +657,7 @@ public override void OnCompleted()
lock (_gate)
{
_atEnd = true;
_subscription.Dispose();
Disposable.TryDispose(ref _subscription);

CheckDone();
}
Expand Down
Expand Up @@ -1813,6 +1813,17 @@ public void Delay_LongRunning_CancelLate()
e.WaitOne();
}

[Fact]
public void Delay_Selector_Immediate()
{
var result = 0;
var source = Observable.Return(1);
var delayed = source.Delay(_ => Observable.Return(2));
delayed.Subscribe(v => result = v);

Assert.Equal(1, result);
}

private class MyLongRunning2 : LocalScheduler, ISchedulerLongRunning
{
private ManualResetEvent _start;
Expand Down

0 comments on commit c3602a1

Please sign in to comment.