New to Telerik Reporting? Download free 30-day trial

Culture is not supported Exception

Environment

Product Progress® Telerik® Reporting
Operating System Windows Server 2012

Description

After deploying my application to a server that uses Windows Server 2012, I am met with the error below when I attempt to load the page with the Report Viewer.

Error Message

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Globalization.CultureNotFoundException: Culture is not supported. Parameter name: name 'aa' is an invalid culture identifier.

Cause

The exception is thrown in the following part of our code:

IEnumerable<string> ILocalizationHandler.AvailableUICultures
{
    get
    {
        var dir = GetResourcesPath();
        //
        var allCultures = CultureInfo.GetCultures(CultureTypes.AllCultures).Select(c => c.Name);
        //
        var cultureInfos = new List<string>();
        if (Directory.Exists(dir))
        {
            foreach (var d in Directory.GetDirectories(dir))
            {
                var directoryName = Path.GetFileName(d);
                var culture = allCultures.FirstOrDefault(c => c == directoryName);
                if (culture != null)
                {
                    cultureInfos.Add(culture);
                }
            }
        }

        return cultureInfos;
    }
}

When using the AllCultures option of the CultureTypes Enum, the GetCultures method will try to retrieve the CultureInfo object for all cultures that are recognized by .NET, including neutral and specific cultures and custom cultures created by the user. The culture 'aa' seems to be a part of these cultures, however, that culture is not included with Windows Server 2012.

Solution

The only solution guaranteed to work for this case is to upgrade the version of Windows Server that you are hosting the Reporting service on to Windows Server 2016 or newer.

Workaround

It may be possible to install new cultures on Windows Server 2012, however, this has not been tested and we cannot guarantee that it will resolve the problem in all scenarios - Installing more cultures on Windows Server 2012.

In this article