Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions src/libraries/System.Reflection/tests/GetTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,14 @@ public void GetType_CoreAssembly()
Assert.Equal(typeof(int), Type.GetType("system.int32", throwOnError: true, ignoreCase: true));
}

[Fact]
public void TestAssemblyNameWithInternationalChar()
{
Type testObj = typeof(Hello工程123.Program);
var t = Type.GetType(testObj.AssemblyQualifiedName);
Assert.NotNull(t);
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37871", TestRuntimes.Mono)]
public void GetType_GenericTypeArgumentList()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace System.Reflection.Hello工程123
{
public class Program
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Hello工程123.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<ProjectReference Include="UnloadableAssembly\UnloadableAssembly.csproj" />
<ProjectReference Include="TestExe\System.Reflection.TestExe.csproj" />
<ProjectReference Include="TestAssembly\TestAssembly.csproj" />
<ProjectReference Include="Hello工程123\Hello工程123.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetOS)' == 'browser'">
<WasmFilesToIncludeFromPublishDir Include="$(AssemblyName).dll" />
Expand All @@ -86,5 +87,6 @@

<!-- Assemblies that should be excluded from the bundle -->
<__ExcludeFromBundle Include="TestAssembly.dll" />
<__ExcludeFromBundle Include="Hello工程123.dll" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions src/mono/mono/eglib/eglib-remap.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
#define g_utf8_strlen monoeg_g_utf8_strlen
#define g_utf8_to_utf16 monoeg_g_utf8_to_utf16
#define g_utf8_to_utf16_custom_alloc monoeg_g_utf8_to_utf16_custom_alloc
#define g_utf8_validate_part monoeg_g_utf8_validate_part
#define g_utf8_validate monoeg_g_utf8_validate
#define g_unichar_to_utf8 monoeg_g_unichar_to_utf8
#define g_utf8_offset_to_pointer monoeg_g_utf8_offset_to_pointer
Expand Down
1 change: 1 addition & 0 deletions src/mono/mono/eglib/glib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,7 @@ int g_mkdir_with_parents (const gchar *pathname, int mode);
*/
extern const guchar g_utf8_jump_table[256];

gboolean g_utf8_validate_part (const unsigned char *inptr, size_t len);
gboolean g_utf8_validate (const gchar *str, gssize max_len, const gchar **end);
gunichar g_utf8_get_char_validated (const gchar *str, gssize max_len);
#define g_utf8_next_char(p) ((p) + g_utf8_jump_table[(guchar)(*p)])
Expand Down
12 changes: 6 additions & 6 deletions src/mono/mono/eglib/gutf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const guchar g_utf8_jump_table[256] = {
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
};

static gboolean
utf8_validate (const unsigned char *inptr, size_t len)
gboolean
g_utf8_validate_part (const unsigned char *inptr, size_t len)
{
const unsigned char *ptr = inptr + len;
unsigned char c;
Expand Down Expand Up @@ -105,7 +105,7 @@ g_utf8_validate (const gchar *str, gssize max_len, const gchar **end)
if (max_len < 0) {
while (*inptr != 0) {
length = g_utf8_jump_table[*inptr];
if (!utf8_validate (inptr, length)) {
if (!g_utf8_validate_part (inptr, length)) {
valid = FALSE;
break;
}
Expand All @@ -124,7 +124,7 @@ g_utf8_validate (const gchar *str, gssize max_len, const gchar **end)
length = g_utf8_jump_table[*inptr];
min = MIN (length, GSSIZE_TO_UINT (max_len - n));

if (!utf8_validate (inptr, min)) {
if (!g_utf8_validate_part (inptr, min)) {
valid = FALSE;
break;
}
Expand Down Expand Up @@ -180,13 +180,13 @@ g_utf8_get_char_validated (const gchar *str, gssize max_len)
}

if (max_len > 0) {
if (!utf8_validate (inptr, MIN (max_len, n)))
if (!g_utf8_validate_part (inptr, MIN (max_len, n)))
return -1;

if (max_len < n)
return -2;
} else {
if (!utf8_validate (inptr, n))
if (!g_utf8_validate_part (inptr, n))
return -1;
}

Expand Down
15 changes: 12 additions & 3 deletions src/mono/mono/metadata/reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1530,8 +1530,17 @@ assembly_name_to_aname (MonoAssemblyName *assembly, char *p)
}
assembly->name = p;
s = p;
while (*p && (isalnum (*p) || *p == '.' || *p == '-' || *p == '_' || *p == '$' || *p == '@' || g_ascii_isspace (*p)))
p++;
guchar *inptr = (guchar *) p;
while (*p && (*p != ',') && (*p != '\0')) {
if (quoted && (*p == '"'))
break;
guint length = g_utf8_jump_table[*inptr];
if (!g_utf8_validate_part (inptr, length)) {
return 0;
}
p += length;
inptr += length;
}
if (quoted) {
if (*p != '"')
return 1;
Expand Down Expand Up @@ -1630,7 +1639,7 @@ assembly_name_to_aname (MonoAssemblyName *assembly, char *p)
found_sep = 1;
continue;
}
/* failed */
/* Done processing */
if (!found_sep)
return 1;
}
Expand Down