none
Culture 4096 (0x1000) is an invalid culture identifier - CultureNotFoundException RRS feed

  • Question

  • Hello. We have a large WPF desktop application and one of our clients is having the above strange exception on startup. Client is located in UK.

    Haven't found too many good answers to this - most of what I saw dealt with ASP.NET apps and IIS.

    It is important to note that we have thousands of users successfully using the same build (including a user sitting right next to the affected client), so it appears to be environmental-related, but we have no idea how to troubleshoot or fix.

    Our support wrote this (in answer to our advice to run Powershell command

    [system.Globalization.CultureInfo]::GetCultures('AllCultures')

    I went to the client today and ran that command in Powershell... but looks like they have cultures.

    en-US was number 1033, and en-UK was 2057.

    All the app is doing at that point is iterate through all the Currencies .NET got from the OS:

    // Get all currencies known to Microsoft .NET at the moment
                CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
                foreach (CultureInfo culture in cultures)
                {
                    var region = new RegionInfo(culture.LCID);
                     ...
                }

    System.Globalization.CultureNotFoundException: Culture is not supported. Parameter name: culture 4096 (0x1000) is an invalid culture identifier. at System.Globalization.CultureData.GetCultureData(Int32 culture, Boolean bUseUserOverride) at System.Globalization.RegionInfo..ctor(Int32 culture)

    Here's the details of what the user has on his machine:

        *************************************** Starting Log ***************************************************
        * OS:                        Windows 7 Enterprise Service Pack 1 6.1.7601.65536 (x64)
        * kernel32.dll version:      6.1.7601.18015 (win7sp1_gdr.121129-1432)
        * .Net Framework Installed:  4.7.2053 (Release (460805) 4.6.1 or later)
        * .Net Runtime:              4.0.30319.42000
        * Silverlight Version:       5.1.50907.0
        * Display Devices:           NVIDIA NVS 510  , AMD FirePro 2460
        * DirectX Version:           4.09.00.0904
        * Processor:                 Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz
        * Memory Info(In MB):        TotalPhysicalMemory = 32675 ,TotalVirtualMemory = 8388607 ,AvailableVirtualMemory = 8387243
        * Rendering Tier:            2
        * Network #1:                Local Area Connection | Intel(R) Ethernet Connection (2) I218-LM | Ethernet | 1,000,000,000 bps
        ******************************************************************************************************** 

    Thanks.

    Wednesday, November 15, 2017 6:42 PM

Answers

  • Thank you Neil.

    We found that there was an offending custom culture file under the Globalization folder in Windows. Renaming it did the trick.

    • Marked as answer by Bati9 Thursday, November 16, 2017 5:02 PM
    Thursday, November 16, 2017 5:02 PM

All replies

  • Hello ,

    >>Culture 4096 (0x1000) is an invalid culture identifier

    Culture 0x1000 is a special culture that is including some new local areas. Because the LCID value doesn't have enough "room" to contains new locals, they all get assigned 0x1000. And I think you could try to change LCID to name first .

      CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
    
                foreach (CultureInfo culture in cultures)
                {
                    var region = new RegionInfo(culture.Name);
                }
    

    And also you could find some useful information from there . It says " it is important to always reference cultures based on the culture name rather than the LCID culture identifier to avoid unintended app behavior.".

    Sincerely,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 16, 2017 3:17 AM
    Moderator
  • Thank you Neil.

    We found that there was an offending custom culture file under the Globalization folder in Windows. Renaming it did the trick.

    • Marked as answer by Bati9 Thursday, November 16, 2017 5:02 PM
    Thursday, November 16, 2017 5:02 PM