Repository navigation
Description
Our company develops and distributes a Powerpoint Add-In.
From the AddIn I add CustomXml parts (referenced to the presentation and the slide as well) to a Powerpoint presentation via DocumentFormat.OpenXml SDK V 2.10. Everything is OK with the file.
Then I copy the file to a SharePoint online. It doesn't matter, if I copy via a WebDAV path, a SharePoint website on a browser or the latest possibility via OneDrive.
Subsequently the behavior of that file varies:
Powerpoint opens the file without problems.
WinRar opens the file and any included data file without problems.
7-Zip opens the file but shows header errors for some included presentation CustomXml itemProperty files.
Open Xml SDK 2.5 Productivity Tool for Microsoft Office cannot open the file, shows "Cannot open the file. The file contains corrupted data."
From code the DocumentFormat.OpenXml Api cannot open the file, throws an System.IO.FileFormatException "The file contains corrupted data."
Opening and saving the "corrupted" pptx file with Powerpoint has a healing effect on the file and it can be used with all mentioned programs without any problems. This is our current workaround. But that's not really satisfying.
But after some further inquiries, I found out that it is the used zipper that has a problem with the data in presentation.pptx file. The error's stacktrace shows that the first error is thrown in the Validate method of the ZipIOLocalFileBlock object:
bei MS.Internal.IO.Zip.ZipIOLocalFileBlock.Validate(String fileName, ZipIOCentralDirectoryBlock centralDir, ZipIOCentralDirectoryFileHeader centralDirFileHeader) bei MS.Internal.IO.Zip.ZipIOLocalFileBlock.SeekableLoad(ZipIOBlockManager blockManager, String fileName) bei MS.Internal.IO.Zip.ZipIOBlockManager.LoadLocalFileBlock(String zipFileName) bei MS.Internal.IO.Zip.ZipArchive.GetFile(String zipFileName) bei MS.Internal.IO.Zip.ZipArchive.GetFiles() bei System.IO.Packaging.ZipPackage.ContentTypeHelper..ctor(ZipArchive zipArchive, IgnoredItemHelper ignoredItemHelper) bei System.IO.Packaging.ZipPackage..ctor(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming) bei System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare, Boolean streaming) bei System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare) bei DocumentFormat.OpenXml.Packaging.OpenXmlPackage.OpenCore(String path, Boolean readWriteMode) bei DocumentFormat.OpenXml.Packaging.PresentationDocument.Open(String path, Boolean isEditable, OpenSettings openSettings) bei DocumentFormat.OpenXml.Packaging.PresentationDocument.Open(String path, Boolean isEditable)
With my last inquiries I found out, that opening the same file in a .NET core application which uses DocumentFormat.OpenXml SDK V 2.10 which itselfs uses System.IO.Compression is runnig without any errors.
It seems, that there is already a fix in the core environment for this problem.
Unfortunately I cannot change to the core variant because the code is running in a Powerpoint AddIn environment.
Regards,
Karl
Activity
danmoseley commentedon Feb 28, 2020
@buyaa-n is this related to what you were lookign at?
buyaa-n commentedon Feb 28, 2020
That is kind of similar problem but not directly related, it is WPF code not sure who owns https://referencesource.microsoft.com/#WindowsBase/Base/MS/Internal/IO/Zip/ZipIOLocalFileBlock.cs,788. @ericstj might know more about this
gomathip02 commentedon Apr 9, 2020
@Kalle4242 - If your company wants us to look into this issue for .NET 4.8 Framework, pls contact support.microsoft.com.
More details here:
https://support.microsoft.com/en-us/hub/4343728/support-for-business
“Get started”
Developer Tools ->.NET Framework-> version->Class libraries namespaces-> System.Windows (WPF)
fabiant3 commentedon May 12, 2020
This issue does not repro in .NET Core, please work with Microsoft support if you require a fix in .NET Framework.