-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restrict Cultures Creation and full support casing in Globalization Invariant Mode #24849
Comments
cc @MichaelSimons @mthalman @richlander - FYI this can affect apps running in alpine docker, since Invariant mode is used there. |
There's two parts here -- the first clearly needs this breaking change note, but do we expect that extending the casing table will actually break anyone? |
I did that per @GrabYourPitchforks request dotnet/runtime#55520 (comment). Technically, users of the Invariant mode will start notice differences. |
I read that and I don't think I follow how it's a "substantial breaking change" (?) Perhaps it might be helpful to give an example of what a break would look like to a user. |
Here is some example: // This condition used to be false and now will start be true.
if ("Á".Equals("á", StringComparison.CurrentCultureIgnoreCase)) // or InvariantCultureIgnoreCase or OrdinalIgnoreCase
{
// do something
}
else
{
// do smoething else
} There are more examples I can add if this can help more. |
Ah right - I was wondering if there's something more subtle. Yup, fair enough. |
Real scenarios can be end users can notice string lists be sorted differently in their apps. But to be honest, I am not expecting anyone take dependency on the Globalization Invariant Mode behavior. I just agreed to @GrabYourPitchforks to document that just in case anyone can see that and proactively fix their code if they think will be broken. |
This sounds to me more like a bug fix than a breaking change. |
Restrict Cultures Creation in Globalization Invariant Mode
Globalization Invariant Mode has been supported in .NET and .NET Core which used in the app scenarios that don't need any globalization support. This mode is turned on by default on some Docker container like Alpine containers.
The behavior of the Globalization Invariant Mode used to allow any culture gets created if the culture name conform to BCP-47. When creating any culture (e.g.
en-US
), the Invariant Culture data will be used instead of the real culture data. This breaking change is changing this behavior which will throw exception when creating any culture other than Invariant Culture.Globalization Invariant Mode was supporting case mapping for ASCII characters range only. We are enabling full case mapping support for Globalization Invariant Mode.
Version introduced
.NET 6.0
Old behavior
New behavior
Reason for change
Recommended action
For anyone using the Globalization Invariant Mode and want to get back the old behavior, can do that by setting the configuration switch
System.Globalization.PredefinedCulturesOnly
tofalse
in the application configuration file or define the environment variableDOTNET_SYSTEM_GLOBALIZATION_PREDEFINED_CULTURES_ONLY=false
.Category
Affected APIs
Issue metadata
The text was updated successfully, but these errors were encountered: