"Memory stream is not expandable" exception #245

Closed
opened 2026-01-29 22:08:57 +00:00 by claunia · 2 comments
Owner

Originally created by @KvanTTT on GitHub (Oct 9, 2017).

I'm trying to extract MemoryStreamIsNotExpandable.zip with the following code:

using (Stream stream = File.OpenRead(sourceArchiveFileName))
{
    using (IReader reader = ReaderFactory.Open(stream))
    {  
        while (reader.MoveToNextEntry())
        {
           ...
        }
    }
}

But got "Memory stream is not expandable" exception after reading of big.png file at while (reader.MoveToNextEntry()) line. This file received from standard Mac compress utility.

With the reason of this error and how can we resolve it?

Originally created by @KvanTTT on GitHub (Oct 9, 2017). I'm trying to extract [MemoryStreamIsNotExpandable.zip](https://github.com/adamhathcock/sharpcompress/files/1369909/MemoryStreamIsNotExpandable.zip) with the following code: ```CSharp using (Stream stream = File.OpenRead(sourceArchiveFileName)) { using (IReader reader = ReaderFactory.Open(stream)) { while (reader.MoveToNextEntry()) { ... } } } ``` But got "Memory stream is not expandable" exception after reading of big.png file at `while (reader.MoveToNextEntry())` line. This file received from standard Mac compress utility. With the reason of this error and how can we resolve it?
Author
Owner

@adamhathcock commented on GitHub (Oct 10, 2017):

Looks like that's a streaming zip and the rewindable buffer can't handle a MemoryStream with a given buffer. Not sure why I hadn't seen this until now. Made a PR

@adamhathcock commented on GitHub (Oct 10, 2017): Looks like that's a streaming zip and the rewindable buffer can't handle a MemoryStream with a given buffer. Not sure why I hadn't seen this until now. Made a PR
Author
Owner

@anuprajg commented on GitHub (Nov 8, 2017):

Is there a plan to Merge this pull request and release a new build?

@anuprajg commented on GitHub (Nov 8, 2017): Is there a plan to Merge this pull request and release a new build?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#245