Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down