Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<TestRuntime>true</TestRuntime>
</PropertyGroup>
<ItemGroup>
<Compile Include="IcuAppLocal.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2.0.9" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Reflection;
using Xunit;

namespace System.Globalization.Tests
{
public class IcuAppLocalTests
{
private static bool SupportIcuLocals => PlatformDetection.IsNotMobile && !PlatformDetection.Is32BitProcess;

[ConditionalFact(nameof(SupportIcuLocals))]
public void TestIcuAppLocal()
{
Type? interopGlobalization = Type.GetType("Interop+Globalization, System.Private.CoreLib");
Assert.NotNull(interopGlobalization);

MethodInfo? methodInfo = interopGlobalization.GetMethod("GetICUVersion", BindingFlags.NonPublic | BindingFlags.Static);
Assert.NotNull(methodInfo);

// Assert the ICU version 0x44020009 is 68.2.0.9
Assert.Equal(0x44020009, (int)methodInfo.Invoke(null, null));

// Now call globalization API to ensure the binding working without any problem.
Assert.Equal(-1, CultureInfo.GetCultureInfo("en-US").CompareInfo.Compare("sample\u0000", "Sample\u0000", CompareOptions.IgnoreSymbols));
}
}
}
1 change: 1 addition & 0 deletions src/native/libs/System.Globalization.Native/pal_icushim.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ void GlobalizationNative_InitICUFunctions(void* icuuc, void* icuin, const char*
ValidateICUDataCanLoad();

InitializeVariableMaxAndTopPointers(symbolVersion);
InitializeUColClonePointers(symbolVersion);
}

#undef PER_FUNCTION_BLOCK
Expand Down