-
Notifications
You must be signed in to change notification settings - Fork 558
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
Comments
I'm seeing this as well. |
I believe this has been fixed in 3.0.2. Please reopen if you're still seeing this |
If I do something like this static void Main(string[] args)
{
try
{
using var doc = WordprocessingDocument.Open(@"S:\test\WIDE.doc", false);
}
catch
{
using var file = File.Open(@"S:\test\WIDE.doc", FileMode.Open, FileAccess.Read);
}
} On .NET 8.0 then the call to Debugging it, it looks like the call to Open-XML-SDK/src/DocumentFormat.OpenXml.Framework/Features/StreamPackageFeature.cs Line 116 in d9ea8cd
(I don't have an option to reopen the issue myself) |
Hello, I am still experiencing this issue on version 3.0.2 and I am unable to reopen the issue. Here is a sample code: using DocumentFormat.OpenXml.Packaging;
Console.WriteLine("Hello, World!");
WordprocessingDocument wDoc = null;
try
{
wDoc = WordprocessingDocument.Open(@"...\corruptedFile.docx", true);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
finally
{
wDoc?.Dispose();
}
Console.ReadKey(); With this code, the file remains locked by the console until it is shut down. Thanks. |
thanks for the response - I'll take a look |
I gave the 3.1.2-ci0019 CI build a test, and the error I was seeing has been fixed by that :-) |
Describe the bug
Opening a corrupted document lock the file.
To Reproduce
Steps to reproduce the behavior:
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
Thanks.
The text was updated successfully, but these errors were encountered: