-
Notifications
You must be signed in to change notification settings - Fork 5k
ZipPackagePart.GetStreamCore crashes with NotSupportedException #30392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Note that this is breaking many different interactions with XPS documents in WPF. |
cc: @ericstj |
|
/cc @stevenbrix |
|
@rladuca said he found a workaround: dotnet/wpf#1363 (comment) |
@stevenbrix This isn't really a broad workaround. While it may be fine in instances where the developer is directly controlling the opening of a Package, they could be using libraries that are doing Package manipulation underneath that they may not be able to influence. The seekability in these modes is going to have to be a documented breaking change from 4.8 for sure, but valid requests to open a Package shouldn't just crash. |
Sorry if I sent any wrong vibes, I want to be clear that I'm not advocating we don't fix this bug. As @ericstj mentioned earlier, the call to
I totally agree, and it would be really nice if there was some sort of matrix that helped us understand what combination of requests are valid, and in which scenario the stream returned supports streaming and when it doesn't. It isn't exactly intuitive that passing |
I agree we should have this documented and not just at the Packaging level. WPF should provide this matrix for its own entry points that plumb down here as well. We don't want people hunting for implementation details just to find out how to use the API. |
Is a fix here going to make the 3.0 milestone? |
We still have time. @stevenbrix was this something you wanted to do or should we assign to someone else? |
@ericstj I can make the fix |
Reopening for release/3.0 port |
Looks like this is resolved now. |
Thanks @stevenbrix for the fix! |
This spawned off investigations done in dotnet/wpf#1363.
A simple reproduction in a console application can be obtained by doing:
A NotSupportedException will arise due to this code:
https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.IO.Packaging/src/System/IO/Packaging/ZipPackagePart.cs#L30-L36
The call to
SetLength
fails since the underlying stream does not support this.The flow here is:
ZipArchiveEntry.GetDataCompressor
creates a newDeflateStream
which is then wrapped, along with the original stream, byCheckSumAndSizeWriteStream
.https://github.com/dotnet/corefx/blob/78589e4d2c98bf71cefa4dbc94cde3783b60a934/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs#L600
CheckSumAndSizeWriteStream
is never seekable and doesn't supportSetPosition
:https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs#L364
It seems that the assumption about the underlying stream is incorrect or the underlying stream should be allowing for this functionality.
The text was updated successfully, but these errors were encountered: