From d3942bb244251784e06d9b456f3d0ad90a660849 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Mon, 27 Feb 2023 09:43:34 -0500 Subject: [PATCH] fix: GetCulturesHierarchy loop on invalid CultureInfo --- src/Uno.UWP/ApplicationModel/Resources/ResourceLoader.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Uno.UWP/ApplicationModel/Resources/ResourceLoader.cs b/src/Uno.UWP/ApplicationModel/Resources/ResourceLoader.cs index b0011f9a5872..12aa0b43c116 100644 --- a/src/Uno.UWP/ApplicationModel/Resources/ResourceLoader.cs +++ b/src/Uno.UWP/ApplicationModel/Resources/ResourceLoader.cs @@ -196,6 +196,14 @@ private static IEnumerable GetCulturesHierarchy(CultureInfo culture) } } + if (culture == culture.Parent) + { + // On .NET Framework 4.8, culture may equal culture.Parent even if it's + // not equal to CultureInfo.InvariantCulture when reaching the end of the + // culture chain. + break; + } + culture = culture.Parent; }