Document breaking change: PackagePart.GetStream() returns non-seekable stream for compressed parts in ReadWrite packages#55225
Conversation
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
| - The part is opened for reading only (`GetStream(FileMode.Open, FileAccess.Read)`). | ||
| - The part is compressed (`CompressionOption` other than `NotCompressed`). | ||
| - The part wasn't written or modified earlier in the same session. | ||
| - The consumer seeks the stream or reads `Position`. |
There was a problem hiding this comment.
I think this line is incorrect and needs to be removed. The intro to the list is talking about when you would see this change, the change being that a forward-only stream is returned. This line is actually describing what causes the exception to throw, which is just a artifact of trying to seek with a non-seekable stream. It has nothing to do with the change.
There was a problem hiding this comment.
The list is the steps required to observe the change. The change would still be there, you just wouldn't observe it, if you didn't seek or read Position. cc @rzikm for his thoughts.
There was a problem hiding this comment.
That's not entirely true though, if the logic checks stream.CanSeek before setting the position, no code will fail via an exception. However, the behavior may now have changed because the code is taking a different path. I think "observe" is the wrong word to use here. I viewed the list as what conditions need to exist to force the underlying type to change, which is what the breaking change is about.
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
System.IO.Packaging.PackagePart.GetStream()now returns a forward-only stream instead of a seekableMemoryStreamwhen reading a compressed, unmodified part from a package opened withFileAccess.ReadWrite, following dotnet/runtime#129698. This change adds the corresponding breaking-change documentation.New article
docs/core/compatibility/core-libraries/11/packagepart-getstream-non-seekable.mdcovering:MemoryStream) vs. new behavior (forward-only stream,CanSeek == false)MemoryStreamwhen seekability is required, or useFileAccess.ReadIndexing
docs/core/compatibility/toc.ymlunder Core .NET libraries for .NET 11docs/core/compatibility/11.mdbreaking changes summary tableExample from the article
Internal previews