The issue tracks the runtime regression failure where
Crossgen2-compiled app is unable to locate a type with non-ASCII
characters in its name. The failure was caused by the fact that
Crossgen2 was incorrectly zero-extending the individual UTF8 characters
when calculating the hash whereas runtime is sign-extending them.
Thanks
Tomas
byte[] src = Encoding.UTF8.GetBytes(name);
for (int i = 0; i < src.Length; i += 2)
{
- hash1 = unchecked(hash1 + RotateLeft(hash1, 5)) ^ src[i];
+ hash1 = unchecked(hash1 + RotateLeft(hash1, 5)) ^ (int)unchecked((sbyte)src[i]);
if (i + 1 < src.Length)
{
- hash2 = unchecked(hash2 + RotateLeft(hash2, 5)) ^ src[i + 1];
+ hash2 = unchecked(hash2 + RotateLeft(hash2, 5)) ^ (int)unchecked((sbyte)src[i + 1]);
}
else
{
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+var type = Type.GetType("_测试数据记录仪_Iiİı_åäö_Controller_DataLogger1_log_all_", false);
+var obj = Activator.CreateInstance(type!);
+Console.WriteLine(obj?.GetType().Name);
+
+return 100;
+
+public class _测试数据记录仪_Iiİı_åäö_Controller_DataLogger1_log_all_
+{
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ <CLRTestPriority>1</CLRTestPriority>
+
+ <!-- This is an explicit crossgen test -->
+ <AlwaysUseCrossGen2>true</AlwaysUseCrossGen2>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="test61104.cs" />
+ </ItemGroup>
+
+</Project>