Aspose.HTML-Cloud conversion from SVG to PNG fails with "The operation was cancelled"

Using Aspose.HTML-Cloud for .NET version 25.10.1. Every time I call the ConvertAsync method, the Status is “Failed”. Happens regardless of whether I use a local file or one in storage. Occurs for multiple SVG files.

var htmlClient = new HtmlApi(clientId, clientSecret);
var htmlResult = await htmlClient.ConvertApi.ConvertAsync("in.svg", "out.png");
// htmlResult.Status is "Failed"

Using Fiddler I was able to get more detail about the error:

{"file":null,"code":200,"id":"CN-60164cee-4166-4417-8632-a2e116031fc5","status":"faulted","description":"ERROR: The operation was canceled. \r\n  STACK TRACE:\r\n   at System.Threading.CancellationToken.ThrowOperationCanceledException()\r\n   at \u0003   .\u0002     \u0002(SVGElement \u0002)\r\n   at \u0003   .\u0002(SVGSVGElement \u0002, CancellationToken \u0003)\r\n   at \u0005   .\u0002(Renderer \u0002, IDevice \u0003, Boolean \u0005, CancellationToken \b, \u0005   [] \u0006)\r\n   at Aspose.Svg.Rendering.SvgRenderer.\u0002(IDevice \u0002, Boolean \u0003, CancellationToken \u0005, \u0005   [] \b)\r\n   at Aspose.Svg.Rendering.SvgRenderer.Render(IDevice device, TimeSpan timeout, SVGDocument[] sources)\r\n   at Aspose.Html.Cloud.V4.Applications.Conversion.Impl.SVGConversionCommandHandler.Execute(ConversionApplicationData data, ApplicationExecutionContext executionContext, CancellationToken token) in C:\\src\\Aspose.HTML.Cloud.V4\\Applications\\Conversion\\Impl\\SVGConversionCommandHandler.cs:line 60\r\n   at Aspose.Html.Cloud.V4.Applications.Conversion.ConversionApplication.Execute(ConversionApplicationData data, ApplicationExecutionContext executionContext, CancellationToken token) in C:\\src\\Aspose.HTML.Cloud.V4\\Applications\\Conversion\\ConversionApplication.cs:line 56\r\n   at Aspose.Html.Cloud.V4.Applications.Conversion.ConversionApplication.<>c__DisplayClass7_0.<ExecuteAsync>b__0(Task`1 x) in C:\\src\\Aspose.HTML.Cloud.V4\\Applications\\Conversion\\ConversionApplication.cs:line 96\r\n","links":{"self":"/v4.0/html/conversion/CN-60164cee-4166-4417-8632-a2e116031fc5","download":null},"originalPath":null}

@contactslaw

Summary
You are seeing a faulted status with the description “The operation was canceled” when calling ConvertAsync on the Aspose HTML‑Cloud .NET SDK (v25.10.1). The stack trace shows a CancellationToken.ThrowOperationCanceledException() coming from the SVG rendering pipeline, which means the conversion job was cancelled before it could finish.

Why it happens

  • The cancellation originates from a CancellationToken that the service or the SDK uses. This can be triggered by:
  1. Server‑side timeout – the cloud service aborts a conversion that exceeds its allowed execution time.
  2. Client‑side timeout – the SDK creates a default CancellationTokenSource with a relatively short timeout (often 60 seconds). If the rendering takes longer, the token is cancelled and the request fails with the observed error.
  3. Resource limits – extremely large or complex SVGs may exceed the memory/CPU limits of the conversion worker, causing the service to cancel the job.
  • Because the failure occurs for every SVG you try (both local and storage files), it is unlikely to be a problem with a particular SVG file.
  • A mismatch between the SDK version you are using and the current cloud service configuration can also lead to premature cancellations.

What to do next

  1. Check the default timeout
var htmlClient = new Aspose.Html.Cloud.Sdk.Api.HtmlApi(clientId, clientSecret);
using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); extend to 5 min
var result = await htmlClient.ConvertApi.ConvertAsync(
inputFile: "in.svg",
outputFormat: "png",
cancellationToken: cts.Token);

If you do not currently pass a CancellationToken, add one with a longer timeout.

  1. Test the raw REST API
curl -X POST " \
-H "Authorization: Bearer <access_token>" \
-F "inputFile=@in.svg" \
-F "outputFormat=png" \
-F "outputFileName=out.png"
  • If the call succeeds, the issue is in the .NET wrapper (likely the timeout handling).
  • If it still fails with the same “operation was canceled” message, the problem is on the service side.
  1. Upgrade / reinstall the SDK
dotnet add package Aspose.HTML-Cloud --version 25.10.1 # or a newer version if available

Newer releases contain fixes for timeout and cancellation handling.

  1. Try a very simple SVG (e.g., a 100 × 100 red square). If this succeeds, the original SVGs may be hitting resource limits; consider simplifying them or splitting large files.

  2. Contact Aspose support

  • Provide the request ID from the JSON response (e.g., CN-60164cee-4166-4417-8632-a2e116031fc5).
  • Mention the SDK version, the code you are using, and the steps you have already taken.
  • Ask them to verify whether there are any service‑side timeout or resource‑limit policies that could be causing the cancellation.

Bottom line: The most common cause is a client‑side timeout that cancels the request before the server finishes rendering. Extending the CancellationToken timeout or upgrading the SDK usually resolves the issue. If the problem persists after these steps, it is a server‑side condition that Aspose support will need to investigate.

Note: The evidence retrieved by the system does not contain specific documentation for this exact error scenario, so the answer is based on typical behavior of the Aspose HTML‑Cloud SDK and the stack trace you provided. Please verify the steps in your environment and reach out to Aspose support if the issue remains unresolved.

:warning: I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.

This is not a client-side issue. The ConvertAsync method in the current version of the SDK does not even accept a CancellationToken parameter, so it cannot request that the operation be cancelled in the first place.

I’m happy to provide sample SVG files if this would help.