Reputation: 2665
There seems to be some difference for CultureInfo between .NET Core and .NET Framework. Is there any reason to this?
Example:
var italian = CultureInfo.GetCultureInfo("it").TextInfo.CultureName;
On .NET Core resolves to:
it
While it previously resolved to on .NET Framework to:
it-IT
This breaks some unit tests. Running this in two clean Console projects yield different results. Tried adding System.Globalization from Nuget without no difference in results.
Is there some configuration needed for this to be the same or have they broken CultureInfo altogheter?
Upvotes: 6
Views: 802
Reputation: 2652
I confirm this behaviour, but Core is more conclusive.
You ask for culture "it", you get culture "it".
.NET Framework is adding more details and specifies a default subculture to it-IT.
If you ask for
var italian = CultureInfo.GetCultureInfo("it-IT").TextInfo.CultureName;
directly.
You will get the same result in both worlds.
To change that string should be a minor problem for your tests.
Upvotes: 2