private async Task DisposeInternalAsync() { await _receiveProcess.TerminateAsync().HandleExceptionsAsync(); IEnumerable <IProxy> proxies; lock (_proxyLock) { proxies = _proxies.Values.ToList(); } await Task.WhenAll(proxies.Select(p => p.DisposeAsync())).HandleExceptionsAsync(); }
private async Task DisposeInternalAsync() { try { // Cancel the initialization _cancellationSource.Cancel(); try { await _initialization; } catch (OperationCanceledException) { } await _snapshotProcess.TerminateAsync(); } catch (OperationCanceledException) { } catch (Exception exc) { _disposalSource.SetException(exc); return; } _disposalSource.SetResult(0); }
public Task TerminateAsync(CancellationToken cancellation) { return(_dynamicProcess.TerminateAsync(cancellation)); }