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()
155155
156156                    public  void  OnCompleted ( ) 
157157                    { 
158-                         _observer . OnCompleted ( ) ; 
159158                    } 
160159
161160                    public  void  OnError ( Exception  error ) 
@@ -233,7 +232,6 @@ public void Dispose()
233232
234233                    public  void  OnCompleted ( ) 
235234                    { 
236-                         _observer . OnCompleted ( ) ; 
237235                    } 
238236
239237                    public  void  OnError ( Exception  error ) 
Original file line number Diff line number Diff line change @@ -705,5 +705,46 @@ public void CreateAsync_Action_Token()
705705            Assert . True ( lst . Take ( 10 ) . SequenceEqual ( Enumerable . Repeat ( 42 ,  10 ) ) ) ; 
706706        } 
707707
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+         } 
708749    } 
709750} 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments