Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
annabelspain opened this issue Nov 4, 2024 · 1 comment

Comments

@annabelspain
Copy link

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:

image

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

image

Other points to note:

  • 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!

@velimirp
Copy link

I have the same problem. Simple pipeline that just clones the repo and runs
"D:\a\_temp\azuredevops-export-wiki.exe" -p "D:\a\1\s/Docs" -o "D:\a\1\s/output/UserManual.pdf" --include-unlisted-pages -v

The result is:

00:00:06.05 No CSS specified, using devopswikistyle.css
00:00:07.26 Converting HTML to PDF
00:00:07.26 No Chrome path defined, downloading to user temp...
00:00:17.84 Chrome ready.
00:00:22.71 Asking Chrome to open 196,701,289 bytes page at C:\Users\VssAdministrator\AppData\Local\Temp\tmp9EC1.html...
00:00:22.71 This may take a few minutes, given the file size.
00:00:54.17 ERR: Something bad happend.
System.IO.IOException: The process cannot access the file 'C:\Users\VssAdministrator\AppData\Local\Temp\tmp9EC1.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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants