Tool Erroring out on temp file - System.IO.IOException: The process cannot access the file '...Local\Temp\tmp1F05.html' because it is being used by another process. #158
When running the tool to export my wiki to PDF, both locally and when using DevOps pipeline I am getting the same error on each run relating to the process not be able to access a temp file.
Local Method:
The wiki has been cloned, saved locally, with version 4.6.0 WikiPDFExport downloaded and used within the folder structure. The steps mentioned within the "quick start" guide were followed (https://github.com/MaxMelcher/AzureDevOps.WikiPDFExport?tab=readme-ov-file#-quickstart). After running the tool, the error appears briefly within the console before exiting the run and closing the command prompt. Please see below the error seen using the local method:
DevOps Method:
The wiki is saved as "wiki as code" repository in DevOps. A yaml pipeline has been created which uses the Wiki PDF Export Tasks (https://marketplace.visualstudio.com/items?itemName=richardfennellBM.BM-VSTS-WikiPDFExport-Tasks&ssr=false#overview), that wraps the WikiPDFExport tool. The pipeline contains three tasks, one to install dotnet 6 onto the build agent, then to run the task as follows below, and the final task publishes the private wiki export as a pipeline artifact. :
- task: richardfennellBM.BM-VSTS-WikiPDFExport-Tasks.WikiPDFExportTask.WikiPdfExportTask@3 displayName: 'Export a private Azure DevOps WIKI'
System.IO.IOException: The process cannot access the file 'C:\Users\VssAdministrator\AppData\Local\Temp\tmp1F05.html' because it is being used by another process.
at System.IO.FileSystem.DeleteFile(String fullPath)
at System.IO.FileInfo.Delete()
at azuredevops_export_wiki.SelfDeletingTemporaryFile.Dispose(Boolean disposing)
at azuredevops_export_wiki.SelfDeletingTemporaryFile.Dispose()
at azuredevops_export_wiki.WikiPDFExporter.Export()
The .order files sit within each section of the folder structure to define the sort order of pages.
Verbose logging has also been activated within the DevOps method, showing that the pipeline iterates through all pages within the wiki, until completing the final page conversion before erroring out on the temp file error seen in the screenshots above.
Additional PowerShell logic has also been tested within the DevOps pipeline, including; checking for concurrent processes, ignore flags on temporary files, remove flags on temporary files, updating to use a unique temporary directory, retry logic to attempt the process three times before sending the error, additional verbose logging and adding delays before and after conversion.
Each time the process is ran across both methods the same error occurs, but the name of each temporary file is different each time.
Any suggestions to get around this error would be really appreciated, thank you for your time!
When running the tool to export my wiki to PDF, both locally and when using DevOps pipeline I am getting the same error on each run relating to the process not be able to access a temp file.
Local Method: The wiki has been cloned, saved locally, with version 4.6.0 WikiPDFExport downloaded and used within the folder structure. The steps mentioned within the "quick start" guide were followed (https://github.com/MaxMelcher/AzureDevOps.WikiPDFExport?tab=readme-ov-file#-quickstart). After running the tool, the error appears briefly within the console before exiting the run and closing the command prompt. Please see below the error seen using the local method:
DevOps Method: The wiki is saved as "wiki as code" repository in DevOps. A yaml pipeline has been created which uses the Wiki PDF Export Tasks (https://marketplace.visualstudio.com/items?itemName=richardfennellBM.BM-VSTS-WikiPDFExport-Tasks&ssr=false#overview), that wraps the WikiPDFExport tool. The pipeline contains three tasks, one to install dotnet 6 onto the build agent, then to run the task as follows below, and the final task publishes the private wiki export as a pipeline artifact. :
- task: richardfennellBM.BM-VSTS-WikiPDFExport-Tasks.WikiPDFExportTask.WikiPdfExportTask@3 displayName: 'Export a private Azure DevOps WIKI'
System.IO.IOException: The process cannot access the file 'C:\Users\VssAdministrator\AppData\Local\Temp\tmp1F05.html' because it is being used by another process. at System.IO.FileSystem.DeleteFile(String fullPath) at System.IO.FileInfo.Delete() at azuredevops_export_wiki.SelfDeletingTemporaryFile.Dispose(Boolean disposing) at azuredevops_export_wiki.SelfDeletingTemporaryFile.Dispose() at azuredevops_export_wiki.WikiPDFExporter.Export()
[error]Error: Command failed: "D:\a_temp\azuredevops-export-wiki.exe" -p "D:\a\1\s/repo/Documentation" -o "D:\a\1\a/PDF/Wiki-As-Code.pdf" -v
[error]Error: Command failed: "D:\a_temp\azuredevops-export-wiki.exe" -p "D:\a\1\s/repo/Documentation" -o "D:\a\1\a/PDF/Wiki-As-Code.pdf" -v
Finishing: Export a private Azure DevOps WIKI
Other points to note:
Any suggestions to get around this error would be really appreciated, thank you for your time!