提交 a57ed018 编写于 作者: R Rob LaDuca 提交者: Robert LaDuca

In .NET Core 3.0 System.IO.Compression's ZipArchive does not support multiple...

In .NET Core 3.0 System.IO.Compression's ZipArchive does not support multiple ZipArchiveEntries to be open concurrently when using FileAccess.Write.  This is a requirement of the XPS serialization stack in WPF.  As such, we need to create XPS documents as FileAccess.ReadWrite in order to allow this behavior.
上级 024e0257
......@@ -894,9 +894,13 @@ bool testIsSignable
Stream dataStream
)
{
// In .NET Core 3.0 System.IO.Compression's ZipArchive does not allow creation of ZipArchiveEntries when
// a prior ZipArchiveEntry is still open. XPS Serialization requires this as part of its implementation.
// To get around this, XPS creation should occur in with FileAccess.ReadWrite if the underlying stream
// supports it. This allows multiple ZipArchiveEntries to be open concurrently.
Package package = Package.Open(dataStream,
FileMode.CreateNew,
FileAccess.Write);
(dataStream.CanRead) ? FileAccess.ReadWrite : FileAccess.Write);
XpsDocument document = new XpsDocument(package);
document.OpcPackage = package;
......
......@@ -139,9 +139,13 @@ CompressionOption compressionOption
{
if( packageAccess == FileAccess.Write )
{
// In .NET Core 3.0 System.IO.Compression's ZipArchive does not allow creation of ZipArchiveEntries when
// a prior ZipArchiveEntry is still open. XPS Serialization requires this as part of its implementation.
// To get around this, XPS creation should occur in with FileAccess.ReadWrite. This allows multiple
// ZipArchiveEntries to be open concurrently.
package = Package.Open(path,
FileMode.Create,
packageAccess,
FileAccess.ReadWrite,
FileShare.None);
streaming = true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册