Bug 37543 - Exception of type 'System.TimeZoneNotFoundException' was thrown.
Summary: Exception of type 'System.TimeZoneNotFoundException' was thrown.
Status: RESOLVED DUPLICATE of bug 28300
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 9.2
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-01-09 13:46 UTC by wowplay
Modified: 2016-04-12 15:54 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 28300

Description wowplay 2016-01-09 13:46:30 UTC
appears when using insights.Initialize("api key");


at System.TimeZoneInfo.GetMonoTouchData (System.String name, Boolean throw_on_error) [0x00021] in /Users/builder/data/lanes/2377/73229919/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System/TimeZoneInfo.MonoTouch.cs:103 
  at System.TimeZoneInfo.CreateLocal () [0x00000] in /Users/builder/data/lanes/2377/73229919/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System/TimeZoneInfo.MonoTouch.cs:49 
  at System.TimeZoneInfo.get_Local () [0x0000c] in /Users/builder/data/lanes/2377/73229919/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System/TimeZoneInfo.cs:75 
  at System.DateTime.ToLocalTime (Boolean throwOnOverflow) [0x00017] in /Users/builder/data/lanes/2377/73229919/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/datetime.cs:1172 
  at System.DateTime.ToLocalTime () [0x00000] in /Users/builder/data/lanes/2377/73229919/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/datetime.cs:1162 
  at System.DateTime.FromFileTime (Int64 fileTime) [0x00000] in /Users/builder/data/lanes/2377/73229919/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/datetime.cs:674 
  at System.Diagnostics.Process.get_StartTime () [0x00000] in /Users/builder/data/lanes/2377/73229919/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Diagnostics/Process.cs:700 
  at Xamarin.InsightsCore.PlatformServices.GetAppUptime () [0x0000c] in <filename unknown>:0 
  at Xamarin.InsightsCore.PlatformServices.Ready () [0x00021] in <filename unknown>:0 
  at Xamarin.InsightsCore.Core.SetupPlatformServices () [0x00073] in <filename unknown>:0 
  at Xamarin.InsightsCore.Core.Initialize (System.String apikey, Xamarin.InsightsCore.WebApi webApi, INetworkAvailability givenNetworkAvailability, IWebPoster webPoster, Boolean blockOnStartupCrashes) [0x00068] in <filename unknown>:0 
  at Xamarin.InsightsCore.Core.Initialize (System.String clientApiKey) [0x00048] in <filename unknown>:0 
  at Xamarin.Insights.Initialize (System.String apiKey, Boolean blockOnStartupCrashes) [0x0002f] in <filename unknown>:0 
  at MyAppOS.AppDelegate.Main (System.String[] args) [0x00008] in AppDelegate.cs:43
Comment 1 Rolf Bjarne Kvinge [MSFT] 2016-01-11 09:58:53 UTC
In which time zone did this occur?

And is it on a jailbroken device?

This is potentially a duplicate of bug #28300.
Comment 2 wowplay 2016-01-11 14:37:07 UTC
GMT +1
It isn't jailbroken

In https://bugzilla.xamarin.com/show_bug.cgi?id=28300 the error appears when using DateTime.Now.ToString(), i'll use this line of code ±50 times and it works fine.
Comment 3 wowplay 2016-01-11 16:17:04 UTC
The result of 
Console.WriteLine ("LocalTimeZone: {0}", NSTimeZone.LocalTimeZone);
		Console.WriteLine ("LocalTimeZone.Data: {0}", NSTimeZone.LocalTimeZone?.Data);
		Console.WriteLine ("LocalTimeZone.Data.Length: {0}", NSTimeZone.LocalTimeZone?.Data?.Length);

Is

116	LocalTimeZone: Europe/Berlin
117	LocalTimeZone.Data: 
118	LocalTimeZone.Data.Length:
Comment 4 wowplay 2016-01-11 16:41:33 UTC
DateTime.Now is not working
DateTime.UtcNow is working fine
Comment 5 Rolf Bjarne Kvinge [MSFT] 2016-01-13 14:36:12 UTC
What device and iOS version is this?

And what does the following code print?

var tz = NSTimeZone.FromName ("Europe/Berlin");
Console.WriteLine ("LocalTimeZone: {0}", tz);
Console.WriteLine ("LocalTimeZone.Data: {0}", tz == null ? "null" : tz.Data);
Console.WriteLine ("LocalTimeZone.Data.Length: {0}", (tz != null && tz.Data != null) ? tz.Data.Length.ToString () : "null");
Comment 6 wowplay 2016-01-16 17:58:08 UTC
1095	LocalTimeZone: Europe/Berlin
1096	LocalTimeZone.Data: <545a6966 00000000 00000000 00000000 00000000 00000008 00000008 00000000 00000090 00000008 0000000e 9b0c1760 9bd5daf0 9cd9ae90 9da4b590 9eb99090 9f849790 c8097190 cce74b10 cda91790 cea24310 cf923410 d0822510 d1721610 d1b69600 d258be80 d2a14f10 d2db34f0 d3631b90 d44b2390 d539d120 d567e790 d5a87300 d629b410 d72c1a10 d8099610 d902c190 d9e97810 12ce97f0 134d4410 1433fa90 1523eb90 1613dc90 1703cd90 17f3be90 18e3af90 19d3a090 1ac39190 1bbcbd10 1cacae10 1d9c9f10 1e8c9010 1f7c8110 206c7210 215c6310 224c5410 233c4510 242c3610 251c2710 260c1810 27054390 27f53490 28e52590 29d51690 2ac50790 2bb4f890 2ca4e990 2d94da90 2e84cb90 2f74bc90 3064ad90 315dd910 3272b410 333dbb10 34529610 351d9d10 36327810 36fd7f10 381b9490 38dd6110 39fb7690 3abd4310 3bdb5890 3ca65f90 3dbb3a90 3e864190 3f9b1c90 40662390 41843910 42460590 43641b10 4425e790 4543fd10 4605c990 4723df10 47eee610 4903c110 49cec810 4ae3a310 4baeaa10 4cccbf90 4d8e8c10 4eaca190 4f6e6e10 508c8390 51578a90 526c6590 53376c90 544c4790 55174e90 562c2990 56f73090 58154610 58d71290 59f52810 5ab6f490 5bd50a10 5ca01110 5db4ec10 5e7ff310 5f94ce10 605fd510 617dea90 623fb710 635dcc90 641f9910 653dae90 6608b590 671d9090 67e89790 68fd7290 69c87990 6add5490 6ba85b90 6cc67110 6d883d90 6ea65310 6f681f90 70863510 71513c10 72661710 73311e10 7445f910 75110010 762f1590 76f0e210 780ef790 78d0c410 79eed990 7ab0a610 7bcebb90 7c99c290 7dae9d90 7e79a490 7f8e7f90 00010203 02030203 02030203 02040003 01020302 05000302 03020301 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 06070607 00001c20 01000000 0e100005 00001c20 01000000 0e100005 00002a30 01090000 2a300109 00001c20 01000000 0e100005 43455354 00434554 0043454d 54000000 01010001 01010000 00000000 0101>
1097	LocalTimeZone.Data.Length: 842
Comment 7 Rolf Bjarne Kvinge [MSFT] 2016-01-18 11:51:18 UTC
So that makes no sense, fetching the NSTimeZone instance based on the name works, but not when it's already the default TZ!?

So maybe it's possible to work around this by assigning to the default TZ. Can you try this code and see what happens: https://gist.github.com/rolfbjarne/8a2d635e5c49168c44ca ?
Comment 8 wowplay 2016-01-20 21:50:44 UTC
9157	20.01.2016 21:46:55 #1: Europe/Berlin: 0x137d83dc0
9158	20.01.2016 21:46:56 Abbreviation: MEZ
9159	20.01.2016 21:46:56 Data: null
9160	20.01.2016 21:46:56 Data.Length: N/A
9161	20.01.2016 21:46:56 Name: Europe/Berlin
9162	20.01.2016 21:46:57 #2: Europe/Berlin: 0x137d83dc0
9163	20.01.2016 21:46:57 Abbreviation: MEZ
9164	20.01.2016 21:46:57 Data: null
9165	20.01.2016 21:46:57 Data.Length: N/A
9166	20.01.2016 21:46:57 Name: Europe/Berlin
9167	20.01.2016 21:46:57 #3: Europe/Berlin: 0x137e95710
9168	20.01.2016 21:46:58 Abbreviation: MEZ
9169	20.01.2016 21:46:58 Data: null
9170	20.01.2016 21:46:58 Data.Length: N/A
9171	20.01.2016 21:46:58 Name: Europe/Berlin
9172	20.01.2016 21:46:59 #4: Europe/Berlin: 0x137e94e30
9173	20.01.2016 21:46:59 Abbreviation: MEZ
9174	20.01.2016 21:46:59 Data: null
9175	20.01.2016 21:46:59 Data.Length: N/A
9176	20.01.2016 21:46:59 Name: Europe/Berlin
9177	20.01.2016 21:46:59 #5: Europe/Berlin: 0x137f3c6d0
9178	20.01.2016 21:46:59 Abbreviation: MEZ
9179	20.01.2016 21:47:00 Data: null
9180	20.01.2016 21:47:00 Data.Length: N/A
9181	20.01.2016 21:47:00 Name: Europe/Berlin
9182	20.01.2016 21:47:00 #6: Europe/Berlin: 0x137d83dc0
9183	20.01.2016 21:47:00 Abbreviation: MEZ
9184	20.01.2016 21:47:00 Data: null
9185	20.01.2016 21:47:00 Data.Length: N/A
9186	20.01.2016 21:47:00 Name: Europe/Berlin
9187	20.01.2016 21:47:01 #7: Europe/Berlin: 0x137e96d70
9188	20.01.2016 21:47:01 Abbreviation: MEZ
9189	20.01.2016 21:47:01 Data: null
9190	20.01.2016 21:47:01 Data.Length: N/A
9191	20.01.2016 21:47:01 Name: Europe/Berlin
9192	20.01.2016 21:47:01 #8: Europe/Berlin: 0x137e95710
9193	20.01.2016 21:47:01 Abbreviation: MEZ
9194	20.01.2016 21:47:02 Data: null
9195	20.01.2016 21:47:02 Data.Length: N/A
9196	20.01.2016 21:47:02 Name: Europe/Berlin
9197	20.01.2016 21:47:02 #9: Europe/Berlin: 0x137f3cb80
9198	20.01.2016 21:47:02 Abbreviation: MEZ
9199	20.01.2016 21:47:02 Data: null
9200	20.01.2016 21:47:02 Data.Length: N/A
9201	20.01.2016 21:47:02 Name: Europe/Berlin
9202	20.01.2016 21:47:03 #10: Europe/Berlin: 0x137d83dc0
9203	20.01.2016 21:47:03 Abbreviation: MEZ
9204	20.01.2016 21:47:03 Data: null
9205	20.01.2016 21:47:03 Data.Length: N/A
9206	20.01.2016 21:47:03 Name: Europe/Berlin
9207	20.01.2016 21:47:03 #11: Europe/Berlin: 0x137e97690
9208	20.01.2016 21:47:03 Abbreviation: MEZ
9209	20.01.2016 21:47:04 Data: null
9210	20.01.2016 21:47:04 Data.Length: N/A
9211	20.01.2016 21:47:04 Name: Europe/Berlin
9212	20.01.2016 21:47:04 #12: Europe/Berlin: 0x137e95710
9213	20.01.2016 21:47:04 Abbreviation: MEZ
9214	20.01.2016 21:47:04 Data: null
9215	20.01.2016 21:47:04 Data.Length: N/A
9216	20.01.2016 21:47:05 Name: Europe/Berlin
9217	20.01.2016 21:47:05 #13: Europe/Berlin: 0x137e97350
9218	20.01.2016 21:47:05 Abbreviation: MEZ
9219	20.01.2016 21:47:05 Data: null
9220	20.01.2016 21:47:05 Data.Length: N/A
9221	20.01.2016 21:47:05 Name: Europe/Berlin
9222	20.01.2016 21:47:06 Exception of type 'System.TimeZoneNotFoundException' was thrown.
9223	20.01.2016 21:47:06   at System.TimeZoneInfo.GetMonoTouchData (System.String name, Boolean throw_on_error) <0x100431dac + 0x000a0> in <filename unknown>:0 
  at System.TimeZoneInfo.CreateLocal () <0x100431d28 + 0x0001f> in <filename unknown>:0 
  at System.TimeZoneInfo.get_Local () <0x100431e68 + 0x00027> in <filename unknown>:0 
  at System.DateTime.ToLocalTime (Boolean throwOnOverflow) <0x10037f718 + 0x00053> in <filename unknown>:0 
  at System.DateTime.FromFileTime (Int64 fileTime) <0x10037e570 + 0x00023> in <filename unknown>:0 
  at System.Diagnostics.Process.get_StartTime () <0x10065e738 + 0x00013> in <filename unknown>:0 
  at Xamarin.InsightsCore.PlatformServices.GetAppUptime () <0x100de1ea0 + 0x00077> in <filename unknown>:0 
  at Xamarin.InsightsCore.PlatformServices.Ready () <0x100de1510 + 0x000bf> in <filename unknown>:0 
  at Xamarin.InsightsCore.Core.SetupPlatformServices () <0x100de627c + 0x00227> in <filename unknown>:0 
  at Xamarin.InsightsCore.Core.Initialize (System.String apikey, Xamarin.InsightsCore.WebApi webApi, INetworkAvailability givenNetworkAvailability, IWebPoster webPoster, Boolean blockOnStartupCrashes) <0x100de5d70 + 0x000f3> in <filename unknown>:0 
  at Xamarin.InsightsCore.Core.Initialize (System.String clientApiKey) <0x100de5c10 + 0x000d7> in <filename unknown>:0 
  at Xamarin.Insights.Initialize (System.String apiKey, Boolean blockOnStartupCrashes) <0x100dded54 + 0x000bf> in <filename unknown>:0 
  at AppchatteniOS.AppDelegate.Main (System.String[] args) <0x10014fcec + 0x0006b> in <filename unknown>:0 
9224	20.01.2016 21:47:06 mscorlib
Comment 9 Rolf Bjarne Kvinge [MSFT] 2016-01-21 12:23:52 UTC
This makes even less sense :(

1. Does this happen in all apps, or just one? i.e. if you create a new app from a template, can you still reproduce?
2. Does it still happen if you change the language of the device (to English for instance), or change the time zone?