From fd7e468e06d76b209e8c46d77b58eed51c1d34b0 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Tue, 27 Jul 2021 13:02:41 +0200 Subject: [PATCH] don't set LastWriteTime when extracting zip files on Android, as it might not be supported and throw, fixes #35374 --- .../Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs b/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs index a74aca915faaf..cfd45e7400adc 100644 --- a/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs +++ b/src/libraries/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.ZipArchiveEntry.Extract.cs @@ -81,7 +81,10 @@ public static void ExtractToFile(this ZipArchiveEntry source, string destination ExtractExternalAttributes(fs, source); } - File.SetLastWriteTime(destinationFileName, source.LastWriteTime.DateTime); + if (!OperatingSystem.IsAndroid()) // https://github.com/dotnet/runtime/issues/35374, https://github.com/mono/mono/issues/17133 + { + File.SetLastWriteTime(destinationFileName, source.LastWriteTime.DateTime); + } } static partial void ExtractExternalAttributes(FileStream fs, ZipArchiveEntry entry);