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
Norway has two official native names in its two official written standards; Norge in Bokmål and Noreg in Nynorsk.
When initializing a new RegionInfo with a Norwegian country code it will have a different value for its NativeName property depending solely on whether you capitalized the country code or not.
What's even worse is that depending on which capitalization you use the first time you initialize a RegionInfo instance the results will be cached and be returned on subsequent initializations of instances regardless of capitalization.
Quick sample code that demonstrates the issue:
using System;using System.Globalization;namespaceConsoleApp1{publicstaticclassProgram{publicstaticvoidMain(string[]args){
Console.WriteLine(new RegionInfo("NO").NativeName);
Console.WriteLine(new RegionInfo("no").NativeName);}}}
Noreg
Noreg
If we change the order we initialize the instances, we get a completely different output:
using System;using System.Globalization;namespaceConsoleApp1{publicstaticclassProgram{publicstaticvoidMain(string[]args){
Console.WriteLine(new RegionInfo("no").NativeName);
Console.WriteLine(new RegionInfo("NO").NativeName);}}}
Norge
Norge
It is expected that both capitalizations of the country code should return the same NativeName regardless of which is used first.
.NET Core version: 3.1.302
OS: Windows 10, version 2004, build 19041.388
The text was updated successfully, but these errors were encountered:
Norway has two official native names in its two official written standards; Norge in Bokmål and Noreg in Nynorsk.
When initializing a new
RegionInfo
with a Norwegian country code it will have a different value for itsNativeName
property depending solely on whether you capitalized the country code or not.The official documentation for the
RegionInfo(string)
constructor specifies that case is not significant.What's even worse is that depending on which capitalization you use the first time you initialize a
RegionInfo
instance the results will be cached and be returned on subsequent initializations of instances regardless of capitalization.Quick sample code that demonstrates the issue:
If we change the order we initialize the instances, we get a completely different output:
It is expected that both capitalizations of the country code should return the same
NativeName
regardless of which is used first..NET Core version: 3.1.302
OS: Windows 10, version 2004, build 19041.388
The text was updated successfully, but these errors were encountered: