-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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() fails on Android #35374
Milestone
Comments
Tagging subscribers to this area: |
@akoeplinger is |
This looks similar to the issue we had with |
adamsitnik
added a commit
to adamsitnik/runtime
that referenced
this issue
Jul 27, 2021
…ight not be supported and throw, fixes dotnet#35374
@SittenSpynne big thanks for a detailed bug report! it got fixed in #56370 and is going to be a part of .NET 6 RC1 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The implementation of
System.Compression.IO.ZipFileExtensions.ExtractToDirectory()
cannot succeed on Android, because it tries to set the file's last accessed time and Android doesn't seem to universally support this.Steps to Reproduce
System.IO.File.SetLastWriteTime()
as the last public thing in the call stack.Here's some example code that could cause the exception, I usually like to include an example project but I'm 3 days behind and just lost a day of debugging to this so please forgive me.
Note that to generate a reasonable
destinationDir
parameter, you've got to do some Android-specific stuff. Here's a pretty good way to generate one in your Android-specific project (I haven't tested on iOS as it's not my development focus right now):This doesn't reproduce if you use a private directory on internal storage. I'm currently working around it by manually iterating the entries of the zip file and using
ZipEntry.Extract(Stream)
. This overload doesn't try to set the last access time because it doesn't know if it's working with a file, so it works.Version Used:
Whatever version VS for Mac is using if I compile a Xamarin.Forms project targeting .NET Standard 2.0. As far as I can tell it's using the 3.1.200 SDK but it claims it's got versions all the way back to 2.1.505.
Stacktrace
This is the stack trace if I use
ZipFile.ExtractToDirectory()
. A similar stack trace happens if I try to call `The text was updated successfully, but these errors were encountered: