System.Globalization.CultureNotFoundException: Culture name zm is not supported. Parameter name: name

Vuyiswa Maseko 351 Reputation points
2021-09-16T12:15:33.43+00:00

Good Day

i get this error reported in Appcentre and the device profile is the following

{
"length": 0,
"offset": 0, ,
"exception": {
"type": "System.Globalization.CultureNotFoundException",
"message": "Culture name zm is not supported.\nParameter name: name",
"stackTrace": " at System.Globalization.CultureInfo..ctor (System.String name, System.Boolean useUserOverride, System.Boolean read_only) [0x00073] in <1b39a03c32ec46258a7821e202e0269f>:0 \n at System.Globalization.CultureInfo.GetCultureInfo (System.String name) [0x00038] in <1b39a03c32ec46258a7821e202e0269f>:0 \n at System.Globalization.RegionInfo..ctor (System.String name) [0x0001e] in <1b39a03c32ec46258a7821e202e0269f>:0 \n at XamarinCountryPicker.ViewModels.AboutViewModel..ctor () [0x00072] in <85954eb968de4c5190b623942df5c30f>:0 ",
"wrapperSdkName": "appcenter.xamarin"
},
"isTestMessage": false,
"timestamp": "2021-09-16T10:43:08.514Z",
"device": {
"sdkName": "appcenter.android",
"sdkVersion": "4.2.0",
"wrapperSdkVersion": "4.3.0",
"wrapperSdkName": "appcenter.xamarin",
"model": "TECNO CG6",
"oemName": "TECNO MOBILE LIMITED",
"osName": "Android",
"osVersion": "11",
"osBuild": "RP1A.200720.011",
"osApiLevel": 30,
"locale": "en_US",
"timeZoneOffset": 120,
"screenSize": "720x1428",
"appVersion": "1.81",
"carrierName": "Airtel",
"carrierCountry": "zm",
"appBuild": "81",
}
}

and this fails in this code

    try
    {
        I18N.Current
      .SetResourcesFolder("Locales") // Optional: The directory containing the resource files (defaults to "Locales")
      .Init(GetType().GetTypeInfo().Assembly); // assembly where locales live
        GenericMethods.DEFAULT_LOCALE = DependencyService.Get<IServiceImei>().GetDefaultLanguage();

        if (GenericMethods.USER_DATA != null)
            I18N.Current.Locale = GenericMethods.Convert_Language_to_Locale(GenericMethods.DEFAULT_LOCALE);

        string CountryCode = GenericMethods.DEFAULT_LOCALE = DependencyService.Get<IServiceImei>().GetDefaultCountry();

        Title = "About";

        RegionInfo myRI1 = new RegionInfo(CountryCode);
        string Country = myRI1.TwoLetterISORegionName.ToString();
        SelectedCountry = CountryUtils.GetCountryModelByName(Country);
        ShowPopupCommand = new Command(async _ => await ExecuteShowPopupCommand());
        CountrySelectedCommand = new Command(country => ExecuteCountrySelectedCommand(country as CountryModel));
    }
    catch(Exception ex)
    {
        Task.Run(() => Crashes.TrackError(ex));
    }

This works perfectly well with all other countries but with the following

System.Globalization.CultureNotFoundException: Culture name tz is not supported. Parameter name: name

System.Globalization.CultureNotFoundException: Culture name bj is not supported. Parameter name: name

System.ArgumentException: Region name tg is not supported. Parameter name: name

System.Globalization.CultureNotFoundException: Culture name mz is not supported. Parameter name: name

System.Globalization.CultureNotFoundException: Culture name na is not supported. Parameter name: name

Gives this error

Thanks

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,013 questions
{count} votes