Bug 58401 - System.IO.Compression.ZipArchive doesn't work with Bookshare zip files
Summary: System.IO.Compression.ZipArchive doesn't work with Bookshare zip files
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: iOS
Classification: Xamarin
Component: BCL Class Libraries ()
Version: XI 10.10 (d15-2)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-07-25 20:47 UTC by Ivan Icin
Modified: 2017-09-19 10:58 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Ivan Icin 2017-07-25 20:47:54 UTC
The same file works properly on Windows.

This is the code that causes exception:

                using (var stream = File.OpenRead(@"C:\SampleDocs\sample.zip"))
                {
                    using (var archive = new System.IO.Compression.ZipArchive(stream))
                    {

                    }
                }

System.IO.InvalidDataException: End of Central Directory record could not be found is raised on the second line.

Bookshare files are zip files (book format known as DAISY) not available on the public internet but you may get samples just by registering as a developer on their site: http://developer.bookshare.org, then find test credentials and available books for test here (after you sign in): http://developer.bookshare.org/docs/read/Bookshare_Test_Data_for_Partners, and then log in to Bookshare and download the book (this link will lead you to one that is available for download for tests: https://www.bookshare.org/search?keyword=Bookshare+Demo%3A+The+Rocket+Boys+of+NIH).
Comment 1 Ivan Icin 2017-07-26 12:25:27 UTC
Also of note, this works on Xamarin.Mac properly. And every single Nuget package with zip support (like SharpCompress) doesn't work on Xamarin.iOS, so I would guess there is some problem somewhere deeper in the framework not just in System.IO.Compression package.
Comment 3 John Miller [MSFT] 2017-07-31 16:43:13 UTC
Hi Ivan,

I was not able to reproduce this issue using the following versions:

=== Visual Studio Community 2017 for Mac (Preview) ===

Version 7.1 Preview (7.1 build 1281)
Installation UUID: b968d862-551c-4a33-ab4e-9666400e357c
Runtime:
	Mono 5.2.0.209 (2017-04/3d531ba) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 502000209

=== Xamarin.iOS ===

Version: 10.12.0.14 (Visual Studio Community)
Hash: bf350ba5
Branch: d15-3
Build date: 2017-07-05 11:08:04-0400

Can you attach your version information and a sample project that reproduces this issue? Thanks!
Comment 4 Ivan Icin 2017-07-31 21:34:37 UTC
Microsoft Visual Studio Community 2017 
Version 15.2 (26430.16) Release
VisualStudio.15.Release/15.2.0+26430.16
Microsoft .NET Framework
Version 4.7.02523

Installed Version: Community

Visual Basic 2017   00369-60000-00001-AA505
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA505
Microsoft Visual C# 2017

Visual C++ 2017   00369-60000-00001-AA505
Microsoft Visual C++ 2017

Visual F# 4.1   00369-60000-00001-AA505
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.6.00404.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30503.0
ASP.NET and Web Tools 2017

Common Azure Tools   1.9
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JavaScript UWP Project System   2.0
JavaScript UWP Project System

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

Multilingual App Toolkit   4.0
Multilingual App Toolkit helps you localize your Windows Store app by providing file management, pseudo and machine translation, translation editor, and build integration. http://aka.ms/matinstall

NuGet Package Manager   4.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

TypeScript   2.2.2.0
TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   15.0.26430.06
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   4.5.0.486 (fec6f88)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   7.3.1.2 (9dbc4c5)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   10.10.0.37 (ad35de4)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 5 Ivan Icin 2017-07-31 21:50:04 UTC
There is the code in the first comment, that's nearly all, but this really must reproduce the problem:

        async static Task extractZip(IFile item)
        {
            using (Stream fileStream = await item.OpenAsync(PCLStorage.FileAccess.Read))
            {
                    using (var archive = new System.IO.Compression.ZipArchive(fileStream ))
                    {

                    }
            }
         }

You have successfully downloaded the book that I've pointed to from Bookshare? It is important that you try exactly on that book.

Also of note, I have resolved the problem using SharpCompress, it works if I avoid auto-detection of the archive type.

There is some possibility that this is a PCLStorage issue, I think I haven't tried without it yet on iOS.
Comment 6 Manuel de la Peña [MSFT] 2017-09-19 10:58:03 UTC
Hello, 

I have been able to download the book. Which is a dir with the following contents:

Bookshare_Demo__The_Rocket_B.ncx
Bookshare_Demo__The_Rocket_B00001.smil
dtbook-2005-3.dtd
Bookshare_Demo__The_Rocket_B.opf
daisy.css
html.css
Bookshare_Demo__The_Rocket_B.xml
daisyTransform.xsl

When testing you sample app I was NOT able to reproduce the issue with the current code at master:

=== Visual Studio Community 2017 for Mac (Preview) ===

Version Preview - Internal Dogfood (7.2 build 576)
Installation UUID: 8d12e55e-3489-463f-ac52-8cb4573c5a81
Runtime:
	Mono 5.4.0.193 (2017-06/5066d707acf) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 504000193

=== NuGet ===

Version: 4.3.0.4199

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	1.1.2
	1.0.5
	1.0.0
SDK: /usr/local/share/dotnet/sdk/1.0.4/Sdks
SDK Versions:
	1.0.4
	1.0.0-preview2-003121
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.5
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: 7.4.0.21 (Visual Studio Community)
Android SDK: /Users/mandel/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		6.0   (API level 23)
		7.1   (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.4
SDK Build Tools Version: 25.0.1

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Inspector ===

Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

=== Apple Developer Tools ===

Xcode 9.0 (13247)
Build 9A235

=== Xamarin.iOS ===

Version: 11.3.0.6 (Visual Studio Community)
Hash: 1690ccbc
Branch: master
Build date: 2017-09-18 17:19:33+0200

=== Xamarin.Mac ===

Version: 4.1.0.7 (Visual Studio Community)

=== Build Information ===

Release ID: 702000576
Git revision: e3f9469d94ad4932e083ecaa6f998865f15fa452
Build date: 2017-09-05 04:52:47-04
Xamarin addins: 088cef5814d09f9af2866d860110075e14f24435
Build lane: monodevelop-lion-dogfood-vNext

=== Operating System ===

Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
    Thu Jun 15 17:36:27 PDT 2017
    root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

Do you have the issue? I'm setting the bug as not reproducible but do feel free to reopen the bug.