Home Dashboard Directory Help

System.Globalization.CultureInfo.CreateSpecificCulture does not always create specific culture. by Peter Ritchie


 as By Design Help for as By Design

Sign in
to vote
Type: Bug
ID: 321241
Opened: 1/6/2008 3:32:32 PM
Access Restriction: Public
User(s) can reproduce this bug


System.Globalization.CultureInfo.CreateSpecificCulture does not always create specific culture. If the user overrides the standards and formats, CreateSpecificCulture results in a user-overridden culture (not a specific culture) if the culture name matches the users current culture.
Sign in to post a comment.
Posted by Microsoft on 8/7/2008 at 9:06 PM
I'm closing this as by design. This method will just use the default way to create a CultureInfo (which does include user overrides if the user's culture matches the one being created), because the user didn't specify anything different. It's main purpose is to have a way to get a non-neutral culture from a neutral culture. The constructor overload that takes a bool can be used if you need to explicitly not pick up the user's preferences.

And thanks for posting the clarifying comment on the documentation. We really appreciate it.

Base Class Libraries Team
Posted by Peter Ritchie on 1/8/2008 at 7:04 AM
Sorry, must have typoed... I've edited the issue for posterity.

Thanks -- Peter
Posted by Microsoft on 1/7/2008 at 3:28 PM

Thanks for your response. I checked the repro steps again and finally repro this issue with the following repro steps. At the step 5, I change Digit grouping symbol from "," to "." instead of from "," to ",". And then we could repro in our lab.

1. Regional and Language Options Control Panel applet the regional options are set to "English (United States)".
2. Click Customize.
3. Click Currency Tab.
4. Change Decimal symbol from "." to ","
5. Change Digit grouping symbol from "," to ","
[MSFT] I think this shuld be from "," to "." (comma->period), otherwise we could not repro the issue.
6. Press Apply
7. Press OK.
8. Press Apply.
9. Compile and run the code.
Posted by Peter Ritchie on 1/7/2008 at 12:44 PM
Are you sure the Regional Settings are set to "English (United States)" and the currency decimal symbol and the currency digit grouping symbol are not ",", and "." respective, as descripted in the steps? I can reproduce this one three difference computers (although all have XP pro SP 2)

The following modified code will assert if this is not the case:
            System.Globalization.CultureInfo ci;
            String text;
            ci = new System.Globalization.CultureInfo("en-us");
            text = String.Format(ci, "{0:c}", 2123.5m);
            // text = "$2.123,50"
            System.Diagnostics.Debug.Assert("$2.123,50" == text);
            ci = new System.Globalization.CultureInfo("en-us", false);
            text = String.Format(ci, "{0:c}", 2123.5m);
            // text = "$2,123.50"
            ci = System.Globalization.CultureInfo.CreateSpecificCulture("en-us");
            text = String.Format(ci, "{0:c}", 2123.5m);
            // text = "$2.123,50"
Posted by Microsoft on 1/7/2008 at 2:00 AM
Thanks for reporting the issue.
In order to fix the issue, we must first reproduce the issue in our labs. We are unable to reproduce the issue with the steps you provided. See attached snapshot_kylin.jpg
It may help if you provide us with:

1. a demo project.
2. more snapshots.

If we do not receive a response from you after 7-days , we will automatically close your issue. There is no obligation to respond -- at any time you may edit your issue via Connect and change the status to “Active.”

Thank you,
Visual Studio Product Team
Sign in to post a workaround.