Having been successfully developing a recent feature a project, I came across an issue suddenly with Xamarin.iOS builds that had gone out to the client. All of a sudden the apps were crashing immediately on startup.
Running the same configuration up locally, everything was working fine. When I ran the code on a device however I discovered the issue that was being spat out through the AppDelegate start up process:
DEBUG: System.EntryPointNotFoundException: xamarin_timezone_get_data
at System.TimeZoneInfo.GetMonoTouchData (System.String name, System.Boolean throw_on_error) [0x00002] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System/TimeZoneInfo.MonoTouch.cs:98
at System.TimeZoneInfo.CreateLocal () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System/TimeZoneInfo.MonoTouch.cs:52
at System.TimeZoneInfo.get_Local () [0x00009] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System/TimeZoneInfo.cs:76
at System.TimeZoneInfo.GetDateTimeNowUtcOffsetFromUtc (System.DateTime time, System.Boolean& isAmbiguousLocalDst) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System/TimeZoneInfo.cs:522
at System.DateTime.get_Now () [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/DateTime.cs:1007
at DarkIce.Toolkit.Helpers.PerfTimerLogger..ctor (System.String message, System.String sourceFile) [0x0004d] in /Users/mattcrombie/Dev/Projects/MyProject/Application/DarkIce.Toolkit/DarkIce.Toolkit/Helpers/PerfTimerLogger.cs:24
Spent all day trying various things that have worked for these kinds of errors in the past (e.g. the following code on startup resolved an issue on Xamarin.Android a long time ago and I’ve been too scared to remove it from projects since haha) and the below code immediately crashing with the same error:
var preserveDateTimeMethods = DateTime.Now.AddYears(1).AddMonths(1).AddDays(1).AddHours(1).AddMinutes(1).AddSeconds(1);<br />
Eventually I remembered that I’d completely instinctively hit update Visual Studio for Mac the day before and I was in the previewchannel. More often than not I find the preview channel quite stable these days, however Xamarin.iOS 22.214.171.124 had this nasty issue.
Rolling back to the stable channel and installing then doing a quick restart sorted everything out and back writing code rather than trying to find a silly error.
Anyway there we go, no exciting new code or tricks but hopefully this helps you if you come across this issue and you can get back to more interesting things!