Bug 30897

Summary: App crashes with Thai locale selected
Product: iOS Reporter: Christer Nordvik <cnordvik>
Component: BCL Class LibrariesAssignee: Marek Safar <masafa>
Severity: normal CC: kumpera, masafa, mono-bugs+monotouch, rolf, sebastien
Priority: ---    
Version: XI 8.10   
Target Milestone: Untriaged   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Crash when formatting dates

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!