File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -894,9 +894,13 @@ bool testIsSignable
894894 Stream dataStream
895895 )
896896 {
897+ // In .NET Core 3.0 System.IO.Compression's ZipArchive does not allow creation of ZipArchiveEntries when
898+ // a prior ZipArchiveEntry is still open. XPS Serialization requires this as part of its implementation.
899+ // To get around this, XPS creation should occur in with FileAccess.ReadWrite if the underlying stream
900+ // supports it. This allows multiple ZipArchiveEntries to be open concurrently.
897901 Package package = Package . Open ( dataStream ,
898902 FileMode . CreateNew ,
899- FileAccess . Write ) ;
903+ ( dataStream . CanRead ) ? FileAccess . ReadWrite : FileAccess . Write ) ;
900904 XpsDocument document = new XpsDocument ( package ) ;
901905
902906 document . OpcPackage = package ;
Original file line number Diff line number Diff line change @@ -139,9 +139,13 @@ CompressionOption compressionOption
139139 {
140140 if ( packageAccess == FileAccess . Write )
141141 {
142+ // In .NET Core 3.0 System.IO.Compression's ZipArchive does not allow creation of ZipArchiveEntries when
143+ // a prior ZipArchiveEntry is still open. XPS Serialization requires this as part of its implementation.
144+ // To get around this, XPS creation should occur in with FileAccess.ReadWrite. This allows multiple
145+ // ZipArchiveEntries to be open concurrently.
142146 package = Package . Open ( path ,
143147 FileMode . Create ,
144- packageAccess ,
148+ FileAccess . ReadWrite ,
145149 FileShare . None ) ;
146150 streaming = true ;
147151 }
You can’t perform that action at this time.
0 commit comments