This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 42082 - [C7SR0] "Ionic.Zip.ZipException ... __AndroidLibraryProjects__.zip is not a valid zip file ---> System.TimeZoneNotFoundException" when building Android projects in certain Windows time zones
Summary: [C7SR0] "Ionic.Zip.ZipException ... __AndroidLibraryProjects__.zip is not a v...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: 6.1.0 (C7)
Hardware: PC Windows
: High major
Target Milestone: 7.0 (C8)
Assignee: dean.ellis
URL:
: 42077 42087 42088 42095 42133 42137 42704 43234 43339 43340 43341 43720 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-06-22 15:48 UTC by Fsalas
Modified: 2016-12-22 18:23 UTC (History)
21 users (show)

See Also:
Tags: BZRC7SR0S1_C7S1, DefectEscapeReview_Done
Is this bug a regression?: Yes
Last known good build: XVS 4.1.0 / XA 6.1.0 (Cycle 7)


Attachments
Demo project with error (5.72 MB, application/zip)
2016-06-24 17:12 UTC, Cristopher
Details

Description Fsalas 2016-06-22 15:48:55 UTC
i´m try to Build or Rebuild the project
and show this error.

"
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error XA0000: Unexpected error - 

Reason: Ionic.Zip.ZipException: C:\xxxx\xxxx\xxxx\obj\Debug\__library_projects__\Refractored.FloatingActionButton\__AndroidLibraryProjects__.zip is not a valid zip file ---> System.TimeZoneNotFoundException: Exception of type 'System.TimeZoneNotFoundException' was thrown. (XA0000) (xxxx) monodroid
"

i´m try to clean and rebuild the project, and unsuccessfully


i´m using Xamarin Studio V 6.0 (Build 5174)

Thank You..
Comment 1 kevin 2016-06-22 18:17:46 UTC
Same issue.  Happened to me yesterday as a result of upgrading to Xamarin 4.1.1.3.
Comment 2 Fsalas 2016-06-22 18:41:50 UTC
Do you solve the problem Kevin?
Comment 3 kevin 2016-06-22 20:20:27 UTC
Sort of.  I uninstalled Xamarin 4.1.1.3 and installed the older version 4.1.0.530.  Not the best fix but at least I can build my project again.
BTW - even though my error is identical to yours I'm using Visual Studio not Xamarin Studio.
Comment 4 Fsalas 2016-06-22 20:27:37 UTC
can you give me the link to old version please?
Comment 5 Fsalas 2016-06-22 20:28:45 UTC
and yes Kevin, if i try to open the project in VS, appear same error
Comment 6 kevin 2016-06-22 21:37:12 UTC
First I went to program files and uninstalled Xamarin from my system(Win10).  Then I just went to the Xamarin web site and downloaded it.  It gives you the old version by default.  Once installed a little 'X' shows up in your task bar telling you there's an upgrade.  DONT take the upgrade.   For me the download was :http://download.microsoft.com/download/E/9/2/E92A2B4D-E618-4BA2-B511-F3C8AD0CB4EA/U2-25123-20160408.4/vstoolsforxamarin.exe

which I got to from here https://www.xamarin.com/download.
Comment 7 dean.ellis 2016-06-23 08:17:37 UTC
Can you post some diagnostic build output and a simple repo project if possible. 
Also some information on the setup of your system (OS, Language, Region etc) might be helpful
Comment 8 dean.ellis 2016-06-23 13:12:00 UTC
*** Bug 42095 has been marked as a duplicate of this bug. ***
Comment 9 Fsalas 2016-06-23 13:40:49 UTC
Sorry Dean Ellis
actually rollback to version 4.1.0.530 to continue working.

My System : 
OS          :   Windows 10 Enterprise 2015 LTSB
Lenguage    :   English
Region      :   Mx
Comment 10 Ashley Gazich 2016-06-23 18:31:58 UTC
*** Bug 42087 has been marked as a duplicate of this bug. ***
Comment 11 Brendan Zagaeski (Xamarin Support) 2016-06-23 20:49:35 UTC
*** Bug 42088 has been marked as a duplicate of this bug. ***
Comment 12 Brendan Zagaeski (Xamarin Support) 2016-06-23 20:50:32 UTC
*** Bug 42077 has been marked as a duplicate of this bug. ***
Comment 14 Brendan Zagaeski (Xamarin Support) 2016-06-24 02:05:59 UTC
*** Bug 42137 has been marked as a duplicate of this bug. ***
Comment 15 Cristopher 2016-06-24 14:57:19 UTC
I have the same error, this is my Xamarin Studio Info:

______________________________________________________________________________

=== Xamarin Studio Enterprise ===

Version 6.0 (build 5174)
Installation UUID: ef0e8e6e-6e4e-4018-b556-9fd731e1746f
Runtime:
    Microsoft .NET 4.0.30319.42000
    GTK+ 2.24.26 (Light theme)
    GTK# 2.12.38

=== Xamarin.Profiler ===

Version: 0.30.0
Location: C:\Program Files (x86)\Xamarin\Profiler\XamarinProfiler.exe

=== Xamarin.Android ===

Version: 6.1.1.1 (Xamarin Enterprise)
Android SDK: C:\Program Files (x86)\Android\android-sdk
    Supported Android versions:
        2.3    (API level 10)
        4.0.3  (API level 15)
        4.1    (API level 16)
        4.2    (API level 17)
        4.3    (API level 18)
        4.4    (API level 19)
        4.4.87 (API level 20)
        5.0    (API level 21)
        5.1    (API level 22)
        6.0    (API level 23)

SDK Tools Version: 25.1.7
SDK Platform Tools Version: 24
SDK Build Tools Version: 24

Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_79
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) Client VM (build 24.79-b02, mixed mode, sharing)

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

=== Xamarin Android Player ===

Not Installed

=== Build Information ===

Release ID: 600005174
Git revision: 694a75f040b7f2309bc43d4f78a3a6572ca898bf
Build date: 2016-06-01 17:11:00-04
Xamarin addins: 33f406fa2dcf214012c78cb846585f062b2e1d24
Build lane: monodevelop-windows-cycle7-baseline

=== Operating System ===

Windows 10.0.10586.0 (64-bit)

_____________________________________________________________________________

Do you need any more info?
Comment 16 Brendan Zagaeski (Xamarin Support) 2016-06-24 16:35:31 UTC
Some other interesting information to collect would be the information mentioned in Comment 7:

> Can you post some diagnostic build output and a simple repo project if possible. 
> Also some information on the setup of your system (OS, Language, Region etc) might be helpful

("Diagnostic build output" refers to: https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output)

Thanks!


Based on the bits of information gathered so far, it seems this issue is likely related to the region and timezone settings of the system environment.
Comment 17 Cristopher 2016-06-24 17:12:32 UTC
Created attachment 16482 [details]
Demo project with error

Normally gives the System.TimeZoneNotFoundException, once I added the MvvmCross or Xamarin Insights Nuget packages it starts sending the Ionic.Zip.ZipException.

Inside the zip file includes a file called "DiagnosticTrace.txt" that contains the build trace with Log verbosity as "diagnostic"
Comment 18 Cristopher 2016-06-24 17:15:58 UTC
Do you have a valid region/timezone to do the test?
Comment 19 Cristopher 2016-06-24 18:13:38 UTC
I disabled the AutoTimeZone and changed it from "Guadalajara, Mexico City, Monterrey" to Central Time (United States and Canada) and it started working!

Hope it gives a hint to correct the issue with all timezones
Comment 20 Brendan Zagaeski (Xamarin Support) 2016-06-24 18:36:14 UTC
Excellent.  Many thanks for the test case and the results about switching time zones in Comment 19!  I have been able to replicate this problem by setting my Windows time zone to "Guadalajara, Mexico City, Monterrey" and building the test case from Comment 17.


I'll leave the engineering team to start investigating the source of the bug while I fill out a few more environment tests to be thorough.
Comment 21 Brendan Zagaeski (Xamarin Support) 2016-06-24 19:56:24 UTC
Additional environment tests follow-up:




## Temporary workaround

Change the Window system time zone to a different time zone.  For example, as reported in Comment 19, switching the time zone to "Central Time (US & Canada)" seems to work.




## Regression status: regression in Cycle 7 – Service Release 0

> BAD:  XamarinVS 4.1.1.3   (34a92cd) / Xamarin.Android 6.1.1.1  (7db2aac) "Cycle 7 – Service Release 0"
> GOOD: XamarinVS 4.1.0.530 (2e39740) / Xamarin.Android 6.1.0.71 (4e27558) "Cycle 7"


(Note to the Xamarin team: This is admittedly somewhat surprising given how few changes there were between these 2 builds (and I see nothing that looks obviously related to time zones).  But I can consistently replicate this change in behavior when I switch back and forth between these 2 versions.)




## Steps to replicate


1. Set the Windows system time zone to "Guadalajara, Mexico City, Monterrey".


2. Attempt to build the test case from Comment 17.  For example, on the command line:

msbuild /t:Build AsyncDemo.sln




## Results

The build fails due to a "TimeZoneNotFoundException":

> monodroid error XA0000: Unexpected error - Please file a bug report at
> http://bugzilla.xamarin.com. Reason: Ionic.Zip.ZipException:
> C:\source\ErrorDemo\obj\Debug\__library_projects__\MvvmCross.Binding.Droid\__AndroidLibraryProjects__.zip
> is not a valid zip file ---> System.TimeZoneNotFoundException: Exception of
> type 'System.TimeZoneNotFoundException' was thrown.




## Additional testing environment info (brief)

Windows 10 (64-bit), US locale

Tested with command line builds in both a VS 2013 Update 5 environment and a VS 2015 Update 2 environment.
Comment 22 Jonathan Pryor 2016-06-27 23:06:12 UTC
*** Bug 42133 has been marked as a duplicate of this bug. ***
Comment 23 dean.ellis 2016-07-20 09:55:53 UTC
I did some tests on the zip file that was extracted and using Ionic.Zip directly on a machine with the timezone set does not produce the error. This only seems to happen when mandroid is doing the extraction. 

I suspect this is to do with mkbundle in this case. I'm not sure how that handles timezones. Since its not relying on the .net runtime but the mono runtime.
Comment 24 dean.ellis 2016-07-20 10:03:14 UTC
I knocked up a test program to extract the file and ran it under mono on the problem machine and it failed in exactly the same way. This seems to be a mono issue.
Comment 25 dean.ellis 2016-07-20 10:16:41 UTC
The test app works fine under mono 4.4.0 on windows, just not under mono 4.3.2. Looks like we need to either 

a) bump the mono we use for mkbundle.
b) figure out what fixed this in mono 4.4.0 and back port it to the version we use for mkbundle
Comment 27 Miguel de Icaza 2016-07-21 21:29:03 UTC
The issue is as follows.

Certain versions of Mono were stripping the ")" out out of the TimeZone, this was part of the patch that added the timezone support for Windows:

d7d456d9 

This was a fix for https://bugzilla.xamarin.com/show_bug.cgi?id=2791

In 2015, we introduced a bug fix for this issue, which stopped the timezone name trimming at ")" because this was valid for Mexico:

33332daa001ec069c14a388c7b461d8bda3bd063

The reason is not registered in bugzilla.

The fix happened in NOvember 6th, 2015.   So it does not look like it is included in 4.4.0 series (someone better than me needs to check if this was cherry picked or not).

That said, while we have a fix there, it is not clear to me that the original code that trimmed text is correct *at all*.   Looking at the CoreCLR implementation, such trimming does not take place.
Comment 28 Alexander Köplinger 2016-07-21 21:50:14 UTC
> The fix happened in NOvember 6th, 2015. So it does not look like it
> is included in 4.4.0 series (someone better than me needs to check
> if this was cherry picked or not).

I cherry-picked it into 4.4 with https://github.com/mono/mono/commit/3c7a0203eeb216656ce9074b42ac612c0d60f462 (the whole thing started as PR https://github.com/mono/mono/pull/2206).
Comment 33 Jonathan Pryor 2016-07-28 18:57:40 UTC
Marking as FIXED, as mandroid.exe doesn't exist in cycle8, and it was mandroid.exe which was producing the System.TimeZoneNotFoundException.
Comment 34 Danish Akhtar 2016-08-01 09:00:45 UTC
I have checked this issue with latest C8 XVS 4.2.0.399 and observed that now this issue is not exists. I have also reproduce this issue with XVS 4.1.1.3

I am successfully able to build attached sample application after following the steps mentioned in Comment 21.

Hence marking this as Verified.
Comment 35 E.Z. Hart 2016-08-10 21:27:24 UTC
*** Bug 43234 has been marked as a duplicate of this bug. ***
Comment 36 Ben Beckley 2016-08-15 23:03:07 UTC
*** Bug 43340 has been marked as a duplicate of this bug. ***
Comment 37 Ben Beckley 2016-08-15 23:03:20 UTC
*** Bug 43339 has been marked as a duplicate of this bug. ***
Comment 38 Ben Beckley 2016-08-15 23:03:35 UTC
*** Bug 43341 has been marked as a duplicate of this bug. ***
Comment 39 Brendan Zagaeski (Xamarin Support) 2016-08-25 03:02:27 UTC
*** Bug 43720 has been marked as a duplicate of this bug. ***
Comment 40 Adrian Alonso 2016-12-22 18:23:33 UTC
*** Bug 42704 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.