public async Task <DelayResponse> DelayAsync(TimeSpan delay, CancellationTokenProxy token) { try { await Task.Delay(delay, token).ConfigureAwait(false); } catch (TaskCanceledException ex) when(ex.CancellationToken == token) { } return(new DelayResponse { IsCanceled = token.IsCancellationRequested, TokenCanBeCanceled = token.CanBeCanceled }); }
public async Task <DelayResponse> DelayAsync(TimeSpan delay, CancellationTokenProxy token) { WaitForOperationStarted.Set(); var result = new DelayResponse { Delay = delay, TokenCanBeCanceled = token.Token.CanBeCanceled }; try { await Task.Delay(delay, token).ConfigureAwait(false); } catch (Exception ex) { result.IsFaulted = true; result.ExceptionType = ex.GetType().AssemblyQualifiedName; result.ExceptionMessage = ex.ToString(); } result.IsCanceled = token.Token.IsCancellationRequested; return(result); }
public Task Method(CancellationTokenProxy token) { throw new NotImplementedException(); }
public bool PassCancellationTokenProxy(CancellationTokenProxy token) { return(Channel.PassCancellationTokenProxy(token)); }
public Task <DelayResponse> DelayAsync(TimeSpan delay, CancellationTokenProxy token) { return(Channel.DelayAsync(delay, token)); }
public bool PassCancellationTokenProxy(CancellationTokenProxy token) { return(token.Token.CanBeCanceled); }