Skip to content

Conversation

@rladuca
Copy link
Member

@rladuca rladuca commented Oct 22, 2019

Related to #1985

5.0 PR: #2073

Description

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.

NOTE: These sort of changes have been used as a workaround in different, but related cases pre-GA of .NET Core 3 and have worked well. Codifying them in the product itself helps move developers forward and gives some time to consider a re-design of the XPS serialization stack.

Customer Impact

XPS creation when a customer chooses FileAccess.Write will get an exception from:
https://github.com/dotnet/corefx/blob/861259bf87d8e4ee2c4f8dab31b73d377faff77d/src/System.IO.Compression/src/System/IO/Compression/ZipArchive.cs#L411

Developers have been instructed to use FileAccess.ReadWrite as a workaround, but this isn't always applicable to library code.

Regression

Yes. This is a regression from .NET Framework 4.8 due to switching to System.IO.Compression and System.IO.Packaging and can potentially block developers from moving their applications to .NET Core.

Risk - Low

The public facing functions that need altering here are on creation of an XPS document where there would generally have been Write access. Switching to ReadWrite should present no problem. There is potential for some optimizations to be lost from within the compression and packaging libs, but that is preferable to throwing an exception.

The internal functions are being changed as a precaution but are generally concerned with printing streams which are, generally, ReadWrite underneath. This merely creates the package in the same access mode as the stream.

…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.
@ghost ghost requested a review from vatsan-madhavan October 22, 2019 15:20
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Oct 22, 2019
@ghost ghost requested a review from SamBent October 22, 2019 15:20
@rladuca rladuca added this to the 3.1 milestone Oct 22, 2019
@rladuca rladuca added * NO MERGE * metadata: The PR is not ready for merge yet (see discussion for detailed reasons) ask-mode regression status: This issue is a regression from a previous build or release Bug Product bug (most likely) labels Oct 22, 2019
@rladuca rladuca changed the title Change XPS document creation to use FileAccess.ReadWrite instead of FileAccess.Write [Release/3.1] Change XPS document creation to use FileAccess.ReadWrite instead of FileAccess.Write Oct 22, 2019
@rladuca rladuca self-assigned this Oct 22, 2019
@rladuca rladuca removed the * NO MERGE * metadata: The PR is not ready for merge yet (see discussion for detailed reasons) label Oct 22, 2019
@rladuca rladuca merged commit c7dcf50 into dotnet:release/3.1 Oct 22, 2019
@rladuca rladuca deleted the xpsmanfix branch December 10, 2019 22:10
@ghost ghost locked as resolved and limited conversation to collaborators Apr 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

ask-mode Bug Product bug (most likely) PR metadata: Label to tag PRs, to facilitate with triage regression status: This issue is a regression from a previous build or release Servicing-approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants