1

Closed

Parsing fails when Window's language format is not English (United States)

description

International users who have set the language format in Windows to be something other than English (United States) may have problems parsing numbers from sessionXml. This is because the numbers in the XML are always formatted in English (United States) no matter what language format Windows is in.
 
For instance, if a user sets his or her language format to Polish and C# tries to parse a float (float.TryParse() or float.Parse()) it will expect a comma as the decimal point rather than a period. In sessionXml, the number will have a period as the decimal point and the parse will fail.
 
Solution: When parsing numbers (int, float, double, etc...) from sessionXml make sure to use System.Globalization.CultureInfo.InvariantCulture as the IFormatProvider.
Closed Feb 9, 2009 at 4:45 AM by DuFF
Fixed in version 2.0.

comments