Output file still in use after document conversion using C#

Hello,

I recently started testing the GroupDocs.Conversion.Converter but quickly ran into a problem moving or deleting the created file.
Running the sample program with the addition of a File.Delete call at the end results in:

System.IO.IOException: ‘The process cannot access the file ‘…’ because it is being used by another process.’

Sample Code:

        string outputFolder = Constants.GetOutputDirectoryPath();
        string outputFile = Path.Combine(outputFolder, "converted.pdf");

        using (Converter converter = new Converter(Constants.SAMPLE_DOCX))
        {
            PdfConvertOptions options = new PdfConvertOptions();
            
            converter.Convert(outputFile, options);
        }
        File.Delete(outputFile);

I was attempting the same thing using the Viewer which works fine.
Can someone please help?

1 Like

@Clemens_Pestuka,

Can you please specify the API version (e.g. 19.11, 19.12) that you integrated in the project? We’ll then further investigate this scenario.

:open_mouth: That was exactly the problem…
I was using 19.11, but updating to 19.12.1 fixes the problem.
Out of curiosity I switched back to 19.11 which also brought back the issue.

Thank you for the easy solution :smiley:

1 Like

@Clemens_Pestuka,

Good to know that :slight_smile:.

The same thing happens for the Java version 19.10.
Will this also be fixed in later versions?

@RalfScania,

Your issue is addressed here.