File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
src/System.Reactive/Linq/Observable
tests/Tests.System.Reactive/Tests/Linq/Observable Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -524,7 +524,10 @@ public override void OnError(Exception error)
524
524
525
525
public override void OnCompleted ( )
526
526
{
527
- Dispose ( ) ;
527
+ // Calling Dispose() here would clear the queue prematurely.
528
+ // We only need to dispose the IDisposable of the upstream,
529
+ // which is done by SafeObserver.Dispose(bool).
530
+ base . Dispose ( true ) ;
528
531
529
532
lock ( _gate )
530
533
{
Original file line number Diff line number Diff line change @@ -4462,13 +4462,17 @@ public void Zip2WithImmediateReturn()
4462
4462
[ Fact ]
4463
4463
public void Zip3WithImmediateReturn ( )
4464
4464
{
4465
- Observable . Zip < Unit , Unit , Unit , Unit > (
4466
- Observable . Return ( Unit . Default ) ,
4467
- Observable . Return ( Unit . Default ) ,
4468
- Observable . Return ( Unit . Default ) ,
4469
- ( _ , __ , ___ ) => Unit . Default
4465
+ int result = 0 ;
4466
+
4467
+ Observable . Zip < int , int , int , int > (
4468
+ Observable . Return ( 1 ) ,
4469
+ Observable . Return ( 2 ) ,
4470
+ Observable . Return ( 4 ) ,
4471
+ ( a , b , c ) => a + b + c
4470
4472
)
4471
- . Subscribe ( _ => { } ) ;
4473
+ . Subscribe ( v => result = v ) ;
4474
+
4475
+ Assert . Equal ( 7 , result ) ;
4472
4476
}
4473
4477
4474
4478
[ Fact ]
You can’t perform that action at this time.
0 commit comments