You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CultureInfo.GetCultureInfo("root") is an accepted but incomplete culture which can raise NullReferenceException on internals #132429
"und" is the correct BCP-47 tag for the "undetermined language" and maps correctly to CultureInfo.InvariantCulture when using CultureInfo.GetCultureInfo("und").
"root" is the alternative moniker used by CLDR.
When using CultureInfo.GetCultureInfo("root") it does not throw a CultureNotFoundException.
Rather it returns an incomplete unknown culture with LCID 4096.
And if one attempts to read NumberFormat off of it:
> System.Globalization.CultureInfo.GetCultureInfo("root").NumberFormat
System.NullReferenceException: Object reference not set to an instance of an object.
+ System.Globalization.NumberFormatInfo.InitializeInvariantAndNegativeSignFlags()
+ System.Globalization.CultureInfo.get_NumberFormat()
Reproduction Steps
Open any C# repl and execute: System.Globalization.CultureInfo.GetCultureInfo("root").NumberFormat
Expected behavior
Either CultureInfo.GetCultureInfo("root") throws a CultureNotFoundException or it produces an actual intact culture.
Actual behavior
CultureInfo.GetCultureInfo("root") is accepted as a valid, recognized culture and does not throw a CultureNotFoundException - however what it produces is in fact not an actual intact culture.
@rjgotten, thanks for reporting it. If you are blocked by any mean, you may consider using und or Invariant culture for that. We can look at the NumberFormat issue when having root name. Or we can just map `root to Invariant culture.
@tarekgh
I'd honestly just reject root with a CultureNotFoundException since it isn't a valid BCP-47 identifier — which is what .NET's CultureInfo converges on after abandoning LCIDs.
@tarekgh
Toyed some more with this. In case you weren't aware yet, accessing CultureInfo.GetCultureInfo("root")beforeCultureInfo.GetCultureInfo("") poisons the well. "root" returns a CultureInfo instance with Name = "" so it appears to take the cache position belonging to the invariant culture.
Anything resolving the invariant culture as "" rather than as an explicit CultureInfo.InvariantCulture afterwards is broken.
Activity
dotnet-policy-service commentedon Aug 17, 2026
Tagging subscribers to this area: @dotnet/area-system-globalization
See info in area-owners.md if you want to be subscribed.
tarekgh commentedon Aug 18, 2026
@rjgotten, thanks for reporting it. If you are blocked by any mean, you may consider using
undor Invariant culture for that. We can look at the NumberFormat issue when havingrootname. Or we can just map `root to Invariant culture.rjgotten commentedon Aug 27, 2026
@tarekgh
I'd honestly just reject
rootwith aCultureNotFoundExceptionsince it isn't a valid BCP-47 identifier — which is what .NET'sCultureInfoconverges on after abandoning LCIDs.rjgotten commentedon Sep 4, 2026
@tarekgh
Toyed some more with this. In case you weren't aware yet, accessing
CultureInfo.GetCultureInfo("root")beforeCultureInfo.GetCultureInfo("")poisons the well."root"returns aCultureInfoinstance withName = ""so it appears to take the cache position belonging to the invariant culture.Anything resolving the invariant culture as
""rather than as an explicitCultureInfo.InvariantCultureafterwards is broken.