/// <summary> /// Attempts to cancel the associated workflow. /// </summary> /// <returns>The tracking <see cref="Task"/>.</returns> public async Task CancelAsync() { await SyncContext.Clear; EnsureStarted(); if (Execution == null) { throw new InvalidOperationException("The stub can't cancel the workflow because it doesn't have the workflow execution."); } await client.CancelWorkflowAsync(Execution, client.ResolveNamespace(Options?.Namespace)); }
/// <summary> /// Cancels the workflow. /// </summary> public async Task CancelAsync() { await SyncContext.Clear; if (parentWorkflow != null) { var stub = parentWorkflow.NewLocalActivityStub <ILocalOperations, LocalOperations>(); await stub.CancelAsync(Execution); } else { await client.CancelWorkflowAsync(Execution, @namespace); } }