Reputation: 2698
I've developed an Windows Phone 8 app which is under beta testing and it is working fine on emulator without fail or crash. but after submitting the app on store as beta version and then download the app on device it load the home page and on navigating through home page it crashing. Actually I dont have the device to test, the error is reported by the beta users. I'm not getting that why my app is facing this error if it is working fine on emulator. Any suggestion would be helpful. Thank you.
Upvotes: 0
Views: 504
Reputation: 39027
When creating an application that is going to be used worldwide, you must keep in mind that different countries use different ways of formatting dates or formatting number. When you use a parse method (double.Parse, DateTime.Parse, ...) without specifying a culture, the user's culture will be used, which often leads to crashes.
The workaround is simply to specify the culture you want to use. In the case of a date, you can event specify the precise date format you want to use.
// Parse a number by forcing the culture to en-US
double.Parse("13.25", CultureInfo.GetCulture("en-US"));
// Parse a date by forcing the culture to en-US
DateTime.Parse("12/31/2011", CultureInfo.GetCulture("en-US"));
// Parse a date by specifying the format
DateTime.ParseExact("12/31/2011", "MM/dd/yyyy", CultureInfo.GetCulture("en-US"));
Upvotes: 1