Skip to content

Adam/1151 release cherry pick#1154

Merged
adamhathcock merged 2 commits intoreleasefrom
adam/1151-release
Jan 23, 2026
Merged

Adam/1151 release cherry pick#1154
adamhathcock merged 2 commits intoreleasefrom
adam/1151-release

Conversation

@adamhathcock
Copy link
Owner

Releasing #1150

Same as #1151

Copilot AI review requested due to automatic review settings January 23, 2026 08:57
@adamhathcock adamhathcock changed the base branch from master to release January 23, 2026 08:57
…ush-issue

Fix EntryStream.Dispose() throwing NotSupportedException on non-seekable streams
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR cherry-picks a fix for issue #1150 where EntryStream.Dispose() was throwing NotSupportedException when flushing Deflate/LZMA streams on non-seekable streams. The fix wraps the Flush() and FlushAsync() calls in try-catch blocks to gracefully handle unsupported stream operations.

Changes:

  • Added exception handling to EntryStream.Dispose() and DisposeAsync() to catch and ignore NotSupportedException from flush operations
  • Version bumped from 0.42.0 to 0.42.1
  • Added tests for the dispose fix and additional unrelated test improvements

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/SharpCompress/Common/EntryStream.cs Added try-catch blocks around Flush/FlushAsync calls in Dispose/DisposeAsync to prevent NotSupportedException from breaking disposal
tests/SharpCompress.Test/Zip/ZipReaderTests.cs Added sync tests for non-seekable stream disposal (contains compilation errors)
tests/SharpCompress.Test/Zip/ZipReaderAsyncTests.cs Added async tests for non-seekable stream disposal (contains compilation errors)
src/SharpCompress/SharpCompress.csproj Bumped version to 0.42.1 for patch release
src/SharpCompress/Factories/ArjFactory.cs Added try-catch to IsArchive to prevent exceptions on non-archive files
tests/SharpCompress.Test/ArchiveTests.cs Added tests for ArchiveFactory.IsArchive behavior on non-archive files
tests/SharpCompress.Test/SharpCompress.Test.csproj Added LEGACY_DOTNET constant for net48 and changed Mono.Posix to Linux-specific
.github/workflows/dotnetcore.yml Added 'release' branch to CI triggers
Comments suppressed due to low confidence (2)

tests/SharpCompress.Test/Zip/ZipReaderTests.cs:416

  • The method ZipReader.OpenReader does not exist. Based on the ZipReader class (src/SharpCompress/Readers/Zip/ZipReader.cs), the correct method is ZipReader.Open(stream). The test should use either ZipReader.Open(stream) or ReaderFactory.Open(stream).
            var readerKeys = new List<string>();

tests/SharpCompress.Test/Zip/ZipReaderTests.cs:435

        var testFiles = new[] { "Zip.none.zip", "Zip.deflate.zip", "Zip.none.issue86.zip" };

        foreach (var testFile in testFiles)
        {
            var path = Path.Combine(TEST_ARCHIVES_PATH, testFile);

            var readerKeys = new List<string>();
            using (var stream = File.OpenRead(path))
            using (var reader = ZipReader.Open(stream))
            {
                while (reader.MoveToNextEntry())
                {
                    readerKeys.Add(reader.Entry.Key!);
                }
            }

            var archiveKeys = new List<string>();
            using (var archive = Archives.Zip.ZipArchive.Open(path))
            {
                foreach (var entry in archive.Entries)
                {
                    archiveKeys.Add(entry.Key!);
                }
            }

            Assert.Equal(archiveKeys.Count, readerKeys.Count);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@adamhathcock adamhathcock merged commit d5a8c37 into release Jan 23, 2026
2 checks passed
@adamhathcock adamhathcock deleted the adam/1151-release branch January 23, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants