Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Invariant Culture ISO Name is "Not a valid name" #10009

Copy link
Copy link
Open
@Draco18s

Description

@Draco18s
Issue body actions

The following:

_ = new CultureInfo(CultureInfo.InvariantCulture.TwoLetterISOLanguageName)

Will throw the error CultureNotFoundException: Culture name iv is not supported. (This happens with the ThreeLetterISOLanguageName "IVL" as well).

This seems... odd, given that _ = new CultureInfo(string.Empty) returns the CultureInfo.InvariantCulture object just fine.

This edge case is not indicated in the documentation.

Why is this important?

Suppose I create a list of CultureInfo that is supported by my application and include the InvariantCulture as a fallback (which would happen if the culture name supplied is an empty string, either accidentally or intentionally). If I serialize this list as cultureList.Select(c => c.TwoLetterISOLanguageName) and then attempt to load it via langNames.Select(n => new CultureInfo(n)), the invariant culture which will have serialized as iv then cannot be deserialized without edge-case detection to convert iv back to an empty string and will instead throw an error I could not have anticipated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri3Indicates issues/PRs that are low priorityIndicates issues/PRs that are low priorityarea-System.GlobalizationuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.