/// <summary> /// Cancel a running translation operation. /// </summary> /// <param name="cancellationToken">A <see cref="CancellationToken"/> used for the service call.</param> public virtual async Task CancelAsync(CancellationToken cancellationToken) { using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(DocumentTranslationOperation)}.{nameof(Cancel)}"); scope.Start(); try { Response <TranslationStatusResult> response = await _serviceClient.CancelOperationAsync(new Guid(Id), cancellationToken).ConfigureAwait(false); _response = response.GetRawResponse(); } catch (Exception e) { scope.Failed(e); throw; } }