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

CreateTempFile throws DirectoryNotFoundException for SXSSFWorkbook #926

Closed
Bertramp opened this issue Sep 22, 2022 · 0 comments · Fixed by #1132
Closed

CreateTempFile throws DirectoryNotFoundException for SXSSFWorkbook #926

Bertramp opened this issue Sep 22, 2022 · 0 comments · Fixed by #1132

Comments

@Bertramp
Copy link

Issue
If the 'poifiles' folder is deleted after an SXSSFWorkbook has been created, creating another in the same process will fail

Since the dir reference of CreateTempFile is static and the temp file is created in the temp folder, there is no guarantee that the path will continue to be valid, as a clean up job may be running once in a while on the temp folder and delete the poifiles directory

Proposed Solution:
Remove static dir variable and always call CreateDirectory as it will create the directory or just return the path if it already exists
I can provide a PR with the fix if you agree on the solution

Steps to reproduce:

  • Create an SXSSFWorkbook and register a sheet
  • Save the workbook
  • Delete the C:\Users\myUser\Local\Temp\poifiles folder manually
  • Create another SXSSFWorkbook and register a sheet
  • This has to happen in the same process

NPOI error

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

Successfully merging a pull request may close this issue.

1 participant