Bug 30897 - App crashes with Thai locale selected
Summary: App crashes with Thai locale selected
Alias: None
Product: iOS
Classification: Xamarin
Component: BCL Class Libraries ()
Version: XI 8.10
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2015-06-08 08:05 UTC by Christer Nordvik
Modified: 2015-06-10 04:37 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Crash when formatting dates (72.22 KB, image/png)
2015-06-08 15:19 UTC, Christer Nordvik

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:

Description Christer Nordvik 2015-06-08 08:05:38 UTC
1. Create an app that uses DateTime.Now
2. Start the app on an actual device
3. It will crash

More details here: 
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-06-08 08:17:09 UTC
@Marek, this is probably something in the MS reference sources, can you have a look?
Comment 2 Sebastien Pouliot 2015-06-08 09:24:16 UTC
Are the I18N assemblies are part of the application (Project Options / Build / iOS Build / Advanced).

Otherwise you'll end up without some pieces, e.g. like custom calendars, but that should the default one (it should not be throwing, something else must have changed).
Comment 3 Marek Safar 2015-06-08 09:59:15 UTC
Do you have any reproducible test case. The failing path should never be hit in your case but I am not sure what went wrong earlier to exhibit this behaviour
Comment 4 Marek Safar 2015-06-08 10:15:49 UTC
I think I managed to reproduce your issue
Comment 5 Marek Safar 2015-06-08 11:42:16 UTC
Fixed in mono master.

Probably easiest workaround is to set the values using properties instead of string keys (if possible)


Add ("Expires", value) is replaced in Expires = value
Comment 6 Christer Nordvik 2015-06-08 15:12:41 UTC
Not sure I understood the workaround here? My code that crashes on Thai (and a few more it seems) is this one: 

titles.Add (DateTime.Now.AddDays (2).ToString("ddd dd MMM"));

Can I detect these locales and force it to use english maybe? I don't have I18N assemblies included.
Comment 7 Marek Safar 2015-06-08 15:16:33 UTC
It may crash on this line (as you do culture sensitive formatting) but the stack trace you linked to is very different.
Comment 8 Christer Nordvik 2015-06-08 15:19:02 UTC
Created attachment 11523 [details]
Crash when formatting dates

Crash when formatting dates
Comment 9 Christer Nordvik 2015-06-08 15:20:45 UTC
Sorry I linked to another developers issue since he had the same type of crash. I attached a screen shot of my crash in case it helps. Do you know which cultures are affected by this bug and maybe I can force them to use English formatting?
Comment 10 Marek Safar 2015-06-09 06:15:47 UTC
You linked to very different issue (which was still unresolved).

For your issue comment #2 applies. You need to include internationalisation codesets if you want to use special calendars.
Comment 11 Christer Nordvik 2015-06-10 04:37:53 UTC
Ok I will include the other calendars (I verified that it works). It didn't crash before though, but at least I have a working solution. Thanks!