LZipStream and disposal of original stream #759

Closed
opened 2026-01-29 22:17:09 +00:00 by claunia · 3 comments
Owner

Originally created by @manfred-brands on GitHub (Jan 19, 2026).

Originally assigned to: @adamhathcock, @Copilot on GitHub.

@adamhathcock PR #1113 changed the Disposal behaviour of LZipStream/BZip2Stream and broke my unit test which expected the stream to still be open.
Now there also is an inconsistency between the Compress and Decompress modes.

All other compression streams my library uses have a leaveOpen parameter.

Would it be possible to add an leaveOpen parameter to LZipStream and BZip2Stream?

I could create a PR for this if you like.

Originally created by @manfred-brands on GitHub (Jan 19, 2026). Originally assigned to: @adamhathcock, @Copilot on GitHub. @adamhathcock PR #1113 changed the Disposal behaviour of LZipStream/BZip2Stream and broke my unit test which expected the stream to still be open. Now there also is an inconsistency between the Compress and Decompress modes. All other compression streams my library uses have a _leaveOpen_ parameter. Would it be possible to add an _leaveOpen_ parameter to `LZipStream` and `BZip2Stream`? I could create a PR for this if you like.
claunia added the enhancementbug labels 2026-01-29 22:17:09 +00:00
Author
Owner

@adamhathcock commented on GitHub (Jan 19, 2026):

Let's see what copilot does but PRs are always welcome

@adamhathcock commented on GitHub (Jan 19, 2026): Let's see what copilot does but PRs are always welcome
Author
Owner

@adamhathcock commented on GitHub (Jan 19, 2026):

Does adding those parameters simply help you or are there further issues?

@adamhathcock commented on GitHub (Jan 19, 2026): Does adding those parameters simply help you or are there further issues?
Author
Owner

@manfred-brands commented on GitHub (Jan 19, 2026):

It would help.
At the moment I have to pass stream as new NonDisposingStream(stream) where NonDisposingStream is a wrapper class with an empty Dispose method.

@manfred-brands commented on GitHub (Jan 19, 2026): It would help. At the moment I have to pass _stream_ as `new NonDisposingStream(stream)` where `NonDisposingStream` is a wrapper class with an empty `Dispose` method.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#759