File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed 
lib/PuppeteerSharp.Tests/NavigationTests Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 11using  Microsoft . AspNetCore . Http ; 
22using  System ; 
33using  System . Collections . Generic ; 
4- using  System . IO ; 
4+ using  System . Linq ; 
55using  System . Net ; 
66using  System . Threading . Tasks ; 
77using  Xunit ; 
@@ -341,7 +341,7 @@ public async Task ShouldReturnLastResponseInRedirectChain()
341341        [ SkipBrowserFact ( skipFirefox :  true ) ] 
342342        public  async  Task  ShouldWaitForNetworkIdleToSucceedNavigation ( ) 
343343        { 
344-             var  responses  =  new  List < TaskCompletionSource < Func < HttpResponse ,  Task > > > ( ) ; 
344+             var  responses  =  new  ConcurrentSet < TaskCompletionSource < Func < HttpResponse ,  Task > > > ( ) ; 
345345            var  fetches  =  new  Dictionary < string ,  TaskCompletionSource < bool > > ( ) ; 
346346            foreach  ( var  url  in  new [ ]  { 
347347                "/fetch-request-a.js" , 
@@ -397,7 +397,10 @@ await Task.WhenAll(
397397                fetches [ "/fetch-request-b.js" ] . Task , 
398398                fetches [ "/fetch-request-c.js" ] . Task ) . WithTimeout ( ) ; 
399399
400-             foreach  ( var  actionResponse  in  responses ) 
400+             var  initialResponses  =  responses . ToArray ( ) ; 
401+             responses . Clear ( ) ; 
402+ 
403+             foreach  ( var  actionResponse  in  initialResponses ) 
401404            { 
402405                actionResponse . SetResult ( response => 
403406                { 
@@ -406,8 +409,6 @@ await Task.WhenAll(
406409                } ) ; 
407410            } 
408411
409-             responses . Clear ( ) ; 
410- 
411412            await  secondFetchResourceRequested . WithTimeout ( ) ; 
412413
413414            Assert . False ( navigationFinished ) ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments