public void Run() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); Thread th = new Thread(new ThreadStart(() => { try { pipedStream.WaitForConnection(); haveConnect = true; } catch { logEx.Error("Run failed"); } })); th.Start(); }