question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XmlLanguage.GetEquivalentCulture doesn't match System.Globalization.CultureInfo

See original GitHub issue
  • .NET Core Version: 5.0
  • Windows version: windows 10
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: No
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc…)? No

Problem description: XmlLanguage.GetEquivalentCulture() no longer matches new System.Globalization.CultureInfo. When compiling with netcoreapp3.1 string1 and string2 in the code block below are the same. With net5.0 they are different.

var string1 = (-10).ToString("C2", new System.Globalization.CultureInfo("en-US"));
var string2 = (-10).ToString("C2", System.Windows.Markup.XmlLanguage.GetLanguage("en-US").GetEquivalentCulture());

Actual behavior: string1 and string2 difer

Expected behavior: string1 and string2 are the same

Minimal repro: See description

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:1
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
miloushcommented, Feb 16, 2023

Here we go: https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu

<ItemGroup>
	<RuntimeHostConfigurationOption Include="System.Globalization.UseNls" Value="true" />
</ItemGroup>

should restore the .NET Framework behavior.

1reaction
innominate227commented, Jan 27, 2023

Here is a reop showing the issue: https://github.com/innominate227/WpfCurrencyNegativePatternIssue. And screenshot of what I see when debugging. image

Read more comments on GitHub >

github_iconTop Results From Across the Web

.net - CultureInfo CurrentCulture does not correspond to ...
When I publish my application though it does not. As a test I added alert("@System.Globalization.CultureInfo.CurrentCulture.
Read more >
Util Class (C1.Util) | ComponentOne OLAP for WPF and ...
Gets a System.Globalization.CultureInfo to match a given System.Windows.Markup.XmlLanguage. Public Method static (Shared in Visual Basic), GetFirstChildOfType ...
Read more >
XmlLanguage.cs source code in C# .NET
The tag may or may not have a registered CultureInfo present on the system. /// This class is useful for dealing with values...
Read more >
CultureInfo Class (System.Globalization)
Provides information about a specific culture (called a locale for unmanaged code development). The information includes the names for the culture, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found