How can I cancel a conversion if it hangs? I use the GroupDocs.Conversion.Converter.Convert method to convert a dfx-file to a PDF. However, the process has been hanging for over 20 minutes and I would like to abort it using code. Is there a way to cancel the process after a certain time, for example with a cancellation token? Or is there also an asynchronous method?
Please share following details and we’ll investigate this scenario:
- API version that you are evaluating (e.g. 19.10, 20.3)
- Sample code your wrote for the conversion process
- For what document type conversion process hangs
- Sample/problematic documents
Details test scenario:
API version: 20.4.0
Test project type: ASP.NET Web Application (.NET Framework 4.7.2, Visual Basic)
Test code snippet (Visual Basic):
Public Class TestController
<HttpGet> Public Function GetTestConvertToPdf(sourceFileName As String) As Byte()
Using sourceStream As New IO.FileStream(sourceFileName, IO.FileMode.Open)
Using converter = New Converter(Function() sourceStream)
Dim convertOptions = New PdfConvertOptions
Using outputStream As New IO.MemoryStream
converter.Convert(Function() outputStream, convertOptions)
Document type: dxf to pdf
Sample/problematic documents: I can’t share this documents because it contains personal data.
But the real question is not why the process hangs, but how I can cancel a conversion process.
I’m looking for a solution like this:
Dim cts = New Threading.CancellationTokenSource
cts.CancelAfter(New TimeSpan(0, 1, 0))
Await converter.ConvertAsync(Function() outputStream, convertOptions, cts.Token)
But there is no async method available.
Thanks for the details. We have logged this scenario as an investigation in our internal issue tracking system with ID CONVERSIONNET-3882. As there’s any update, you’ll be notified.