-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZipFile.ExtractToDirectory throws IOException #2005
Comments
I am seeing this as well. The workaround seems to not perform as well so would really like this addressed soon. |
Be nice to see this fixed. |
@jonpryor Hi Jonathan. I was just wondering, does the XA team require any more information to investigate this issue? |
@jonathanpeppers @JonDouglas Just wondering if this issue can be investigated? |
@mattrichnz this seems weird that it works on Xamarin.iOS. That System.IO.Compression code is in Mono’s BCL so should be the same on both platforms. It Labor Day (holiday weekend) in the US, but I should be able to look at this next week. |
@jonathanpeppers Thanks Jonathan - We really appreciate that so much. |
@mattrichnz this project (ExtractZipArchive.zip) worked for me on a Pixel 2 (running Android Pie) and a HAXM emulator (running Android Oreo). I am also using VS 2017 15.8.2 (on Windows), which has Xamarin.Android 9.0. As a side note, in your sample, I had to add this code:
Or subsequent runs would fail saying the files already exist. So the question is:
|
@jonathanpeppers Thanks for looking into this issue. Note: I've also updated the repro project to include your code adjustment: ExtractZipArchiveV2.zip |
@jonathanpeppers See additional device test results below. Two passing and one failing device. Motorola Moto G4 (Android 7.0) Motorola XT1032 (Android 5.1) Samsung GT-5110 (Android 4.4)
|
@mattrichnz could this be an issue with your timezone? New Zealand, right? If we look at this code, it uses Can you add this code and see if any of the dates look fishy? using (var zip = ZipFile.OpenRead (sourceArchiveFilename)) {
foreach (var entry in zip.Entries) {
Console.WriteLine ($"File: {entry.FullName}, {entry.LastWriteTime.DateTime}");
}
} Output:
You might also try setting the timezone on the device to a US one and see what happens? |
@jonathanpeppers Thanks Jonathan. I've added the sample code you mentioned, with one minor change to show DateTimeOffset: Console output:
Everything looks as expected. I retested on all the devices I have here too and tried changing timezone etc. ASUS P028 (Android 7.0) Motorola Moto G4 (Android 7.0) Motorola XT1032 (Android 5.1) Samsung GT-5110 (Android 4.4) |
@jonathanpeppers Seems that setLastModified() is unreliable on Android, working on some devices and not others. Android issue: Other references:
So, it seems this is not a Mono issue but an Android OS issue. Our workaround has been to put underlying code from Mono's BCL into a static extension method and remove the call to Would you have any further recommendations? |
@mattrichnz I would definitely recommend your approach. Even if we got a change in Mono, it takes quite a while for that to make it to a Visual Studio release. What concerns me though... Does |
@jonathanpeppers Good Q. I tested on the affected devices and doesn't break. Well, that's a relief 👍 Our final solution in the end was to put the call to Marking this issue as closed since not related to Xamarin.Android or Mono but to the FUSE filesystem in Android OS. Since FUSE has been replaced by SDCardFS in Android Oreo and above, this issue is effectively resolved in future versions of Android. |
Steps to Reproduce
System.IO.Compression.ZipFile.ExtractToDirectory
to extract a ZIP archive.Expected Behavior
Method executes successfully.
Actual Behavior
Method fails and an
IOException
is thrown with the following stack trace:Note: Method executes successfully on Xamarin.iOS and Windows environments.
Version Information
Visual Studio Professional 2017 for Mac
Version 7.5.3 (build 7)
Installation UUID: 62b6ba72-e19d-446a-96a0-c688ca3c1161
Runtime:
Mono 5.10.1.57 (2017-12/ea8a24b1bbf) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)
NuGet
Version: 4.3.1.4445
.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.1.1
2.0.5
2.0.0
1.0.2
SDK: /usr/local/share/dotnet/sdk/2.1.301/Sdks
SDK Versions:
2.1.301
2.1.4
2.0.0
1.0.0-preview2-003148
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/msbuild/15.0/bin/Sdks
Xamarin.Profiler
Version: 1.6.2
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Apple Developer Tools
Xcode 9.4.1 (14161)
Build 9F2000
Xamarin.Mac
Version: 4.4.1.193 (Visual Studio Professional)
Xamarin.iOS
Version: 11.12.0.4 (Visual Studio Professional)
Hash: 64fece5f
Branch: d15-7
Build date: 2018-05-29 20:00:44-0400
Xamarin.Android
Version: 8.3.3.2 (Visual Studio Professional)
Android SDK: /Users/mattrichnz/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
7.0 (API level 24)
7.1 (API level 25)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 27.0.1
SDK Build Tools Version: 27.0.3
Java SDK: /usr
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Xamarin Inspector
Version: 1.4.0
Hash: b3f92f9
Branch: master
Build date: Fri, 19 Jan 2018 22:00:34 GMT
Client compatibility: 1
Build Information
Release ID: 705030007
Git revision: 13cecd02aceddf29a1ed57b86f81c02994df1483
Build date: 2018-06-14 15:48:08-04
Xamarin addins: 7065de97cf22c9038fdc39dd627f2c30790fd8af
Build lane: monodevelop-lion-d15-7
Operating System
Mac OS X 10.13.6
Darwin 17.7.0 Darwin Kernel Version 17.7.0
Thu Jun 21 22:53:14 PDT 2018
root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
Enabled user installed addins
StyleCop Support 1.1.0.0
Internet of Things (IoT) development (Preview) 7.5
Workaround
The text was updated successfully, but these errors were encountered: