Index: src/Gallio/Gallio/Runtime/Hosting/IsolatedProcessHost.cs
===================================================================
--- src/Gallio/Gallio/Runtime/Hosting/IsolatedProcessHost.cs	(revision 3346)
+++ src/Gallio/Gallio/Runtime/Hosting/IsolatedProcessHost.cs	(working copy)
@@ -18,7 +18,6 @@
 using System.Diagnostics;
 using System.IO;
 using System.Reflection;
-using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading;
 using System.Windows.Forms;
@@ -54,8 +53,9 @@
     /// </remarks>
     public class IsolatedProcessHost : RemoteHost
     {
-        private static readonly TimeSpan ReadyTimeout = TimeSpan.FromSeconds(60);
+        private static readonly TimeSpan ReadyTimeout = TimeSpan.FromSeconds(120);
         private static readonly TimeSpan ReadyPollInterval = TimeSpan.FromSeconds(0.5);
+        private static readonly TimeSpan ReadyPingTimeout = TimeSpan.FromSeconds(2);
         private static readonly TimeSpan PingInterval = TimeSpan.FromSeconds(5);
         private static readonly TimeSpan JoinBeforeAbortTimeout = TimeSpan.FromMinutes(10); // This timeout is purposely long to allow code coverage tools to finish up.
         private static readonly TimeSpan JoinBeforeAbortWarningTimeout = TimeSpan.FromSeconds(10);
@@ -72,6 +72,8 @@
         private IClientChannel clientChannel;
         private IServerChannel callbackChannel;
         private SeverityPrefixParser severityPrefixParser;
+        private string hostConnectionArguments;
+        private bool shouldIgnoreProcessExit;
 
         private const int logConsoleOutputBufferTimeoutMilliseconds = 100;
         private readonly Timer logConsoleOutputBufferTimer;
@@ -103,7 +105,6 @@
         {
             try
             {
-                string hostConnectionArguments;
                 Func<IClientChannel> clientChannelFactory;
                 Func<IServerChannel> callbackChannelFactory;
                 PrepareConnection(uniqueId, out hostConnectionArguments, out clientChannelFactory, out callbackChannelFactory);
@@ -349,43 +350,69 @@
             }
             else
             {
-                var diagnostics = new StringBuilder();
-                int exitCode = processTask.ExitCode;
-                diagnostics.AppendFormat("Host process exited with code: {0}", exitCode);
+                if (shouldIgnoreProcessExit)
+                {
+                    Logger.Log(LogSeverity.Info, "Host process exit ignored." + DateTime.Now.ToLongTimeString());
+                    shouldIgnoreProcessExit = false;
+                }
+                else
+                {
+                    var diagnostics = new StringBuilder();
+                    int exitCode = processTask.ExitCode;
+                    diagnostics.AppendFormat("Host process exited with code: {0}", exitCode);
 
-                string exitCodeDescription = processTask.ExitCodeDescription;
-                if (exitCodeDescription != null)
-                    diagnostics.Append(" (").Append(exitCodeDescription).Append(")");
+                    string exitCodeDescription = processTask.ExitCodeDescription;
+                    if (exitCodeDescription != null)
+                        diagnostics.Append(" (").Append(exitCodeDescription).Append(")");
 
-                Logger.Log(exitCode != 0 ? LogSeverity.Error : LogSeverity.Info, diagnostics.ToString());
+                    Logger.Log(exitCode != 0 ? LogSeverity.Error : LogSeverity.Info, diagnostics.ToString());
+                }
             }
 
             NotifyDisconnected();
         }
 
-        [DebuggerNonUserCode]
         private void WaitUntilReady(IHostService hostService)
         {
             Stopwatch stopwatch = Stopwatch.StartNew();
 
-            for (; ; )
+            while (stopwatch.Elapsed < ReadyTimeout)
             {
+                Thread.Sleep(ReadyPollInterval);
                 EnsureProcessIsRunning();
 
-                try
+                var isPingSuccess = false;
+                var ping = new ThreadTask("ping", () => isPingSuccess = Ping(hostService));
+                if (ping.Run(ReadyPingTimeout))
                 {
-                    hostService.Ping();
-                    return;
+                    if (isPingSuccess)
+                    {
+                        return;
+                    }
                 }
-                catch (Exception)
+                else
                 {
-                    if (stopwatch.Elapsed >= ReadyTimeout)
-                        throw;
+                    shouldIgnoreProcessExit = true;
+                    processTask.Abort();
+                    StartProcess(hostConnectionArguments);
                 }
+            }
 
-                EnsureProcessIsRunning();
-                Thread.Sleep(ReadyPollInterval);
+            Logger.Log(LogSeverity.Error, "Could not connect to host process in time.");
+            throw new HostException("Could not connect to host process in time.");
+        }
+
+        private bool Ping(IHostService hostService)
+        {
+            try
+            {
+                hostService.Ping();
+                return true;
             }
+            catch (Exception e)
+            {
+                return false;
+            }
         }
 
         private void EnsureProcessIsRunning()
