internal void Finish() { if (hasInstrumentation) { hasInstrumentation = false; Listener.ReleaseInstrumentation(this); } finishedTask.TrySetResult(null); contextTask.TrySetCanceled(); }
internal void Abort(Exception exception = null) { if (hasInstrumentation) { hasInstrumentation = false; Listener.ReleaseInstrumentation(this); } if (exception != null) { finishedTask.TrySetException(exception); contextTask.TrySetException(exception); OnError(exception); } else { finishedTask.TrySetCanceled(); contextTask.TrySetCanceled(); OnCanceled(); } }