The android test was not handling CultureNotFoundException and was crashing.
Fixes https://github.com/dotnet/runtime/issues/51016
<!-- Execution may be compromised -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.Caching.Memory\tests\Microsoft.Extensions.Caching.Memory.Tests.csproj" />
- <!-- https://github.com/dotnet/runtime/issues/51016 -->
- <ProjectExclusions Include="$(RepoRoot)\src\tests\FunctionalTests\Android\Device_Emulator\InvariantCultureOnlyMode\Android.Device_Emulator.InvariantCultureOnlyMode.Test.csproj" />
-
<!-- PSNE -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Console/tests/System.Console.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Net.NetworkInformation/tests/FunctionalTests/System.Net.NetworkInformation.Functional.Tests.csproj" />
{
public static int Main(string[] args)
{
- var culture = new CultureInfo("es-ES", false);
- // https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-invariant-mode.md#cultures-and-culture-data
- int result = culture.LCID == 0x1000 && culture.NativeName == "Invariant Language (Invariant Country)" ? 42 : 1;
+ CultureInfo culture;
+ int result = 1;
+
+ try
+ {
+ // only invariant culture is supported, so it should error.
+ culture = new CultureInfo("es-ES", false);
+ }
+ catch(CultureNotFoundException)
+ {
+ culture = CultureInfo.InvariantCulture;
+ // https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-invariant-mode.md#cultures-and-culture-data
+ result = culture.LCID == 127 && culture.NativeName == "Invariant Language (Invariant Country)" ? 42 : 1;
+ }
return result;
}
{
mono_ios_set_summary($"Starting functional test");
CultureInfo culture;
- try
+ int result = 1;
+
+ try
{
+ // only invariant culture is supported, so it should error.
culture = new CultureInfo("es-ES", false);
}
- catch
+ catch(CultureNotFoundException)
{
- culture = new CultureInfo("", false);
+ culture = CultureInfo.InvariantCulture;
+ // https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-invariant-mode.md#cultures-and-culture-data
+ result = culture.LCID == 127 && culture.NativeName == "Invariant Language (Invariant Country)" ? 42 : 1;
}
- // https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-invariant-mode.md#cultures-and-culture-data
- int result = culture.LCID == CultureInfo.InvariantCulture.LCID && culture.NativeName == "Invariant Language (Invariant Country)" ? 42 : 1;
-
- Console.WriteLine("Done!");
await Task.Delay(5000);
-
return result;
}
}