Skip to content

Commit e910860

Browse files
authored
[mono] Use string.Empty for empty string custom arg values (#58023)
* Fixes #58022
1 parent 12beab4 commit e910860

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/mono/mono/metadata/custom-attrs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,11 @@ MONO_RESTORE_WARNING
397397
// to decode some attributes in assemblies that Windows .NET Framework
398398
// and CoreCLR both manage to decode.
399399
// See https://simonsapin.github.io/wtf-8/ for a description of wtf-8.
400-
*out_obj = (MonoObject*)mono_string_new_wtf8_len_checked (p, slen, error);
400+
// Always use string.Empty for empty strings
401+
if (slen == 0)
402+
*out_obj = (MonoObject*)mono_string_empty_internal (mono_domain_get ());
403+
else
404+
*out_obj = (MonoObject*)mono_string_new_wtf8_len_checked (p, slen, error);
401405
return NULL;
402406
}
403407
case MONO_TYPE_CLASS: {

0 commit comments

Comments
 (0)