/// <summary> /// Perform an action and retry on I/O failure, with a 1 second /// sleep between retries. /// </summary> /// <param name="action">The action to perform.</param> private static void PerformActionWithRetry(Action action) { for (int attempt = 1; attempt <= MaxAttempts; ++attempt) { try { action(); return; } catch (UnauthorizedAccessException) { if (MaxAttempts == attempt) { throw; } } catch (IOException) { if (MaxAttempts == attempt) { throw; } } IsamTestHelper.ThreadSleep(TimeSpan.FromSeconds(1)); } }