Bug 36318 - ZipFile.ExtractToDirectory not supported
Summary: ZipFile.ExtractToDirectory not supported
Status: RESOLVED DUPLICATE of bug 36154
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Base Class Libraries ()
Version: 2.4.0 (C6)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2015-11-27 20:24 UTC by Aaron Bockover [MSFT]
Modified: 2016-05-02 18:32 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 DUPLICATE of bug 36154

Description Aaron Bockover [MSFT] 2015-11-27 20:24:50 UTC
The XM mobile profile provides System.IO.Compression and System.IO.Compression.FileSystem, but it is broken.

I was hoping to use System.IO.Compresion.ZipFile.ExtractToDirectory, but it throws a NotSupportedException: "No data is available for encoding 437".

The "csharp" (system Mono) REPL does not exhibit this problem, and can successfully extract the intended zip archive. I suspect that we are simply missing an assembly in the XM FX that is loaded dynamically. There may be a number of missing archive support assemblies in addition to zip.

Exception:

System.TypeInitializationException: The type initializer for 'SharpCompress.Common.ArchiveEncoding' threw an exception. ---> System.NotSupportedException: No data is available for encoding 437.
  at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00214] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/text/encoding.cs:520
  at SharpCompress.Common.ArchiveEncoding..cctor () [0x00000] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression/SharpCompress/Common/ArchiveEncoding.cs:24
  --- End of inner exception stack trace ---
  at SharpCompress.Common.Zip.Headers.ZipFileEntry.DecodeString (System.Byte[] str) [0x00025] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression/SharpCompress/Common/Zip/Headers/ZipFileEntry..cs:28
  at SharpCompress.Common.Zip.Headers.DirectoryEntryHeader.Read (System.IO.BinaryReader reader) [0x000b9] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression/SharpCompress/Common/Zip/Headers/DirectoryEntryHeader.cs:32
  at SharpCompress.Common.Zip.ZipHeaderFactory.ReadHeader (UInt32 headerBytes, System.IO.BinaryReader reader) [0x00086] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression/SharpCompress/Common/Zip/ZipHeaderFactory.cs:51
  at SharpCompress.Common.Zip.SeekableZipHeaderFactory+<ReadSeekableHeader>c__Iterator0.MoveNext () [0x00146] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression/SharpCompress/Common/Zip/SeekableZipHeaderFactory.cs:52
  at SharpCompress.Archive.Zip.ZipArchive+<LoadEntries>c__Iterator0.MoveNext () [0x0013c] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression/SharpCompress/Archive/Zip/ZipArchive.cs:204
  at SharpCompress.LazyReadOnlyCollection`1+LazyLoader[T].MoveNext () [0x0002d] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression/SharpCompress/LazyReadOnlyCollection.cs:63
  at System.IO.Compression.ZipArchive.CreateZip (System.IO.Stream stream, ZipArchiveMode mode) [0x000f7] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression/ZipArchive.cs:117
  at System.IO.Compression.ZipArchive..ctor (System.IO.Stream stream, ZipArchiveMode mode, Boolean leaveOpen, System.Text.Encoding entryNameEncoding) [0x00034] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression/ZipArchive.cs:85
  at System.IO.Compression.ZipFile.Open (System.String archiveFileName, ZipArchiveMode mode, System.Text.Encoding entryNameEncoding) [0x00096] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression.FileSystem/ZipFile.cs:173
  at System.IO.Compression.ZipFile.ExtractToDirectory (System.String sourceArchiveFileName, System.String destinationDirectoryName, System.Text.Encoding entryNameEncoding) [0x00011] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression.FileSystem/ZipFile.cs:128
  at System.IO.Compression.ZipFile.ExtractToDirectory (System.String sourceArchiveFileName, System.String destinationDirectoryName) [0x00000] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/mcs/class/System.IO.Compression.FileSystem/ZipFile.cs:117
  at Conservatorio.Mac.MacUpdater+<InstallAsync>c__AnonStorey0.<>m__0 () [0x00019] in /Users/aaron/src/conservatorio/Conservatorio.Mac/MacUpdater.cs:45
  at System.Threading.Tasks.Task.InnerInvoke () [0x00012] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/threading/Tasks/Task.cs:2901
  at System.Threading.Tasks.Task.Execute () [0x00016] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/threading/Tasks/Task.cs:2523
  at --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:201
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:124
  at Conservatorio.Mac.MainWindowController+<AwakeFromNib>c__async7.MoveNext () [0x00032] in /Users/aaron/src/conservatorio/Conservatorio.Mac/MainWindowController.cs:133
  at --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (System.Object state) [0x00000] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:994
  at AppKit.AppKitSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () [0x0000c] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/src/AppKit/AppKitSynchronizationContext.cs:17
  at Foundation.NSAsyncActionDispatcher.Apply () [0x00008] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/src/Foundation/NSAction.cs:163
  at at (wrapper managed-to-native) AppKit.NSApplication:NSApplicationMain (int,string[])
  at AppKit.NSApplication.Main (System.String[] args) [0x00041] in /Users/builder/data/lanes/2097/815e5d67/source/maccore/src/AppKit/NSApplication.cs:94
  at Conservatorio.Mac.MainClass.Main (System.String[] args) [0x00007] in /Users/aaron/src/conservatorio/Conservatorio.Mac/Main.cs:35
Comment 1 Aaron Bockover [MSFT] 2015-11-27 20:26:35 UTC
This also happens with the non-mobile profile, which is a little unexpected.
Comment 2 Chris Hamons 2015-11-30 19:23:35 UTC
Same exact error message as another bug that just came in.

*** This bug has been marked as a duplicate of bug 36154 ***
Comment 3 Chris Hamons 2015-11-30 19:24:26 UTC
Thought it is using DotNetZip instead of  System.IO.Compresion.ZipFile.ExtractToDirectory. I'll note in other bug.
Comment 4 Chris Hamons 2016-05-02 18:32:20 UTC
Just for clarity sake, we've documented the steps needed to "fix" this here:

https://developer.xamarin.com/guides/mac/application_fundamentals/troubleshooting/#System.NotSupportedException_No_data_is_available_for_encoding_437