This repository was archived by the owner on Jan 23, 2023. It is now read-only.
[release/3.1] Ensure Image.Save can handle non readable / seekable Streams - #42994
Merged
Conversation
Port of dotnet/runtime@00685a7 Fix Image.Save on Unix for write only non-seekable stream and remove test which uses bogus handle value.
ericstj
force-pushed
the
writeOnlyImageSave31
branch
from
September 23, 2020 23:25
715da24 to
fc14558
Compare
Anipik
approved these changes
Sep 24, 2020
safern
approved these changes
Sep 24, 2020
|
Is there a prediction when v3.1.10 will be released? We face this issue in some 3rd party lib and have to decide if we can wait or have to work around. |
|
It will be released around 2nd week of november |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port dotnet/runtime#36805 to release/3.1.
Original issue: dotnet/runtime#33522
Summary
When calling
Image.Saveand passing in a stream to write the image to we started throwingNotSupportedExceptionif the stream could not be read. This happened accidentally as part of a performance fix in 3.x. That fix tried to ensure a seekable stream and would copy the backing stream contents when doing so. This was unnecessary work (and an unnecessary copy) since saving the image only requires writing and not reading nor seeking.Customer Impact
Customer encounters
NotSupportedExceptionwhen trying to save an image when they did not before. This is blocking service update to 3.1 for the customer as well as preventing their upstack consumers of this service from updating.Workaround would involve saving to a
MemoryStreamthen copying to the final stream, which is undesirable. This significantly increases CPU and memory usage to a in a commonly used component low in the stack.Regression?
Yes, from 2.1: dee4344
Testing
Unit tests added to cover this scenario. Partner has been using 5.0 fix.
Risk
Low. This is undoing a regression and fix has been in place in 5.0 for months.