Пример #1
0
        private Task StartProcessingAsync(ITestRequestHandler requestHandler, ITestHostManagerFactory managerFactory)
        {
            var task = new Task(
                () =>
            {
                // Wait for the connection to the sender and start processing requests from sender
                // Note that we are waiting here infinitely to connect to vstest.console, but at the same time vstest.console doesn't wait infinitely.
                // It has a default timeout of 60secs(which is configurable), & then it kills testhost.exe
                // The reason to wait infinitely, was remote debugging scenarios of UWP app,
                // in such cases after the app gets launched, VS debugger takes control of it, & causes a lot of delay, which frequently causes timeout with vstest.console.
                // One fix would be just double this timeout, but there is no telling how much time it can actually take.
                // Hence we are waiting here indefinitely, to avoid such guessed timeouts, & letting user kill the debugging if they feel it is taking too much time.
                // In other cases if vstest.console's timeout exceeds it will definitely such down the app.
                if (requestHandler.WaitForRequestSenderConnection(ClientListenTimeOut))
                {
                    EqtTrace.Info("DefaultEngineInvoker.StartProcessingAsync: Connected to vstest.console, Starting process requests.");
                    requestHandler.ProcessRequests(managerFactory);
                }
                else
                {
                    EqtTrace.Info(
                        "DefaultEngineInvoker.StartProcessingAsync: RequestHandler timed out while connecting to the Sender.");
                    throw new TimeoutException();
                }
            },
                TaskCreationOptions.LongRunning);

            task.Start();
            return(task);
        }
Пример #2
0
 private Task StartProcessingAsync(ITestRequestHandler requestHandler, ITestHostManagerFactory managerFactory)
 {
     return(Task.Run(() =>
     {
         // Wait for the connection to the sender and start processing requests from sender
         if (requestHandler.WaitForRequestSenderConnection(ClientListenTimeOut))
         {
             requestHandler.ProcessRequests(managerFactory);
         }
         else
         {
             EqtTrace.Info("DefaultEngineInvoker: RequestHandler timed out while connecting to the Sender.");
             throw new TimeoutException();
         }
     }));
 }