Since version 0.19 iOS zip open stream doesn't work #347

Closed
opened 2026-01-29 22:10:29 +00:00 by claunia · 6 comments
Owner

Originally created by @ghost on GitHub (Apr 11, 2019).

The exception is raised on this line:

using (var archive = SharpCompress.Archives.Zip.ZipArchive.Open(fileStream))

The strange thing is that if I catch the exception it is null, so I can't provide any other info...

The same code works on UWP in all versions of SharpCompress, but on iOS 0.18.2 is the last version that processes this line properly.

Originally created by @ghost on GitHub (Apr 11, 2019). The exception is raised on this line: `using (var archive = SharpCompress.Archives.Zip.ZipArchive.Open(fileStream))` The strange thing is that if I catch the exception it is null, so I can't provide any other info... The same code works on UWP in all versions of SharpCompress, but on iOS 0.18.2 is the last version that processes this line properly.
claunia added the bugup for grabs labels 2026-01-29 22:10:29 +00:00
Author
Owner

@adamhathcock commented on GitHub (Apr 12, 2019):

Can only guess it has something to do with .NET Standard 2.0 targetting. I don't use iOS (Xamarin?) so will need help.

here's the changelog for 0.19: https://github.com/adamhathcock/sharpcompress/releases/tag/0.19

@adamhathcock commented on GitHub (Apr 12, 2019): Can only guess it has something to do with .NET Standard 2.0 targetting. I don't use iOS (Xamarin?) so will need help. here's the changelog for 0.19: https://github.com/adamhathcock/sharpcompress/releases/tag/0.19
Author
Owner

@ghost commented on GitHub (Apr 12, 2019):

It works on Xamarin.Android, so it is isolated to Xamarin.iOS and I think Xamarin.Mac.

Surely I can help if it means that I should test some code report exceptions etc.

@ghost commented on GitHub (Apr 12, 2019): It works on Xamarin.Android, so it is isolated to Xamarin.iOS and I think Xamarin.Mac. Surely I can help if it means that I should test some code report exceptions etc.
Author
Owner

@ghost commented on GitHub (Jul 16, 2020):

I found the bug it is here:

        public ArchiveEncoding()
        {
            Default = Encoding.GetEncoding(437);
            Password = Encoding.GetEncoding(437);
        }

This is causing System.NotSupportedException on iOS and macOS

Using any other encoding like UTF8 resolves this for me.

@adamhathcock can you fix the problem with this info?

@ghost commented on GitHub (Jul 16, 2020): I found the bug it is here: ``` public ArchiveEncoding() { Default = Encoding.GetEncoding(437); Password = Encoding.GetEncoding(437); } ``` This is causing System.NotSupportedException on iOS and macOS Using any other encoding like UTF8 resolves this for me. @adamhathcock can you fix the problem with this info?
Author
Owner

@ghost commented on GitHub (Jul 16, 2020):

Also this means that this can work on iOS if you check 'west' in internationalization project properties, but it is unchecked by default.

@ghost commented on GitHub (Jul 16, 2020): Also this means that this can work on iOS if you check 'west' in internationalization project properties, but it is unchecked by default.
Author
Owner

@adamhathcock commented on GitHub (Jul 16, 2020):

I should probably just change it to be Encoding.Default because 437 is problematic and old. I think it was just the default for Zip files back in the day.

@adamhathcock commented on GitHub (Jul 16, 2020): I should probably just change it to be Encoding.Default because 437 is problematic and old. I think it was just the default for Zip files back in the day.
Author
Owner

@adamhathcock commented on GitHub (Jul 26, 2020):

New release https://www.nuget.org/packages/sharpcompress/0.26.0 should fix this

@adamhathcock commented on GitHub (Jul 26, 2020): New release https://www.nuget.org/packages/sharpcompress/0.26.0 should fix this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#347