private static async ValueTask RetryOnSharingViolationAsync(Action action) { var attempt = 0; while (attempt < 10) { try { action(); return; } catch (IOException ex) when(IOUtilities.IsSharingViolation(ex)) { } attempt++; await Task.Delay(50).ConfigureAwait(false); } }
private static void RetryOnSharingViolation(Action action) { var attempt = 0; while (attempt < 10) { try { action(); return; } catch (IOException ex) when(IOUtilities.IsSharingViolation(ex)) { } attempt++; Thread.Sleep(50); } }
public ValueTask DisposeAsync() { return(IOUtilities.DeleteAsync(new DirectoryInfo(FullPath))); }
public void Dispose() { IOUtilities.Delete(new DirectoryInfo(FullPath)); }
public ValueTask DisposeAsync() { return(IOUtilities.DeleteAsync(new DirectoryInfo(FullPath), CancellationToken.None)); }