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

Bug with opening corrupted Open XML documents #1681

Open
BenjaminLopVic opened this issue Feb 28, 2024 · 1 comment
Open

Bug with opening corrupted Open XML documents #1681

BenjaminLopVic opened this issue Feb 28, 2024 · 1 comment

Comments

@BenjaminLopVic
Copy link

Describe the bug
Opening a corrupted document lock the file.

To Reproduce
Steps to reproduce the behavior:

  1. Simulate a corrupted file (simply create a txt file with content in it and change the extension to .docx)
  2. Try opening the file with WordProcessingDocument.Open(...)

Observed behavior
The method WordProcessingDocument.Open(...) throws an exception, stating that the file is corrupted but keeps the file locked to. This can be verified using tools like "File Locksmith."

Expected behavior
Continue throwing the exception but release the file before.

Desktop

  • OS: Windows 11
  • .NET Target: .NET Framework 4.8
  • DocumentFormat.OpenXml Version: 3.0.1

Thanks.

@BenjaminLopVic BenjaminLopVic changed the title Bug with corrupted Open XML documents Bug with opening corrupted Open XML documents Feb 28, 2024
@Numpsy
Copy link
Contributor

Numpsy commented Mar 15, 2024

I'm seeing this as well.
Opening the file myself and passing the stream into WordprocessingDocument.Open instead of the path might be a work around.

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