private async void ReconnectIn(TimeSpan delay) { if (!await _semConnecting.WaitAsync(0)) { return; } try { Trace.TraceInformation("Reconnecting in {0} seconds ...", ((int)delay.TotalSeconds).ToString()); await Task.Delay(delay); Trace.TraceInformation("Reconnecting now ..."); } finally { _semConnecting.Release(); } try { await _ipcClient.ConnectAsync().ConfigureAwait(false); } catch (Exception) { //ignored //will be handled in _ipcClient_Error } }