Culture is not supported (WPF)

158 Views Asked by At

Within a WPF App (.NET Framework 4.5.2) I use an IValueConverter to get the RegionInfo from a 2 letter region code:

public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {

 if (value != null) { // 
  // we use local list of regions (due to perfomance issue : new RegionInfo() )
  //
  var key = value.ToString();
  if (regionsName.ContainsKey(key)) return regionsName[key];

  regionsName.Add(key, new RegionInfo(value.ToString()).DisplayName);
  return regionsName[key];
 }

 return null;
}        

This works well almost everywhere. Now one customer gets an exception:

TypeString: System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Culture name "MU" is not supported. Parametername: name

When I locally call the Convert-Method with value="MU" I get 'Mauritius' as corresponding DisplayName (from RegionInfo). So "MU" seems to be a valid RegionCode.

So why is this code unknown on the clients machine? And how can I fix this?

0

There are 0 best solutions below