File tree Expand file tree Collapse file tree 2 files changed +41
-2
lines changed
tests/Tests.System.Reactive/Tests/Linq/Observable Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,6 @@ public void Dispose()
155
155
156
156
public void OnCompleted ( )
157
157
{
158
- _observer . OnCompleted ( ) ;
159
158
}
160
159
161
160
public void OnError ( Exception error )
@@ -233,7 +232,6 @@ public void Dispose()
233
232
234
233
public void OnCompleted ( )
235
234
{
236
- _observer . OnCompleted ( ) ;
237
235
}
238
236
239
237
public void OnError ( Exception error )
Original file line number Diff line number Diff line change @@ -705,5 +705,46 @@ public void CreateAsync_Action_Token()
705
705
Assert . True ( lst . Take ( 10 ) . SequenceEqual ( Enumerable . Repeat ( 42 , 10 ) ) ) ;
706
706
}
707
707
708
+
709
+ [ Fact ]
710
+ public void CreateWithTaskDisposable_NoPrematureTermination ( )
711
+ {
712
+ var obs = Observable . Create < int > ( async o =>
713
+ {
714
+ // avoid warning on async o due to no await
715
+ await Task . CompletedTask ;
716
+
717
+ var inner = Observable . Range ( 1 , 3 ) ;
718
+
719
+ return inner . Subscribe ( x =>
720
+ {
721
+ o . OnNext ( x ) ;
722
+ } ) ;
723
+ } ) ;
724
+
725
+ var result = obs . Take ( 1 ) . Wait ( ) ;
726
+ }
727
+
728
+ [ Fact ]
729
+ public void CreateWithTaskAction_NoPrematureTermination ( )
730
+ {
731
+ var obs = Observable . Create < int > ( async o =>
732
+ {
733
+ // avoid warning on async o due to no await
734
+ await Task . CompletedTask ;
735
+
736
+ var inner = Observable . Range ( 1 , 3 ) ;
737
+
738
+ var d = inner . Subscribe ( x =>
739
+ {
740
+ o . OnNext ( x ) ;
741
+ } ) ;
742
+
743
+ Action a = ( ) => d . Dispose ( ) ;
744
+ return a ;
745
+ } ) ;
746
+
747
+ var result = obs . Take ( 1 ) . Wait ( ) ;
748
+ }
708
749
}
709
750
}
You can’t perform that action at this time.
0 commit comments