-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[release/6.0] [mono] Use string.Empty for empty string custom arg values #58113
Conversation
Tagging subscribers to this area: Issue DetailsBackport of #58023 to release/6.0 /cc @lambdageek @uweigand Customer ImpactTestingRisk
|
Is a unit test infeasible? |
And not a new string object that happens to be `""` Adds a testcase for #58023
Added a test. Also in #58197 for |
*out_obj = (MonoObject*)mono_string_new_wtf8_len_checked (p, slen, error); | ||
// Always use string.Empty for empty strings | ||
if (slen == 0) | ||
*out_obj = (MonoObject*)mono_string_empty_internal (mono_domain_get ()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: wouldn't mono_string_empty_wrapper be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that one is marked MONO_RT_EXTERNAL_ONLY
so cannot be used in runtime code.
Backport of #58023 to release/6.0
/cc @lambdageek @uweigand
Customer Impact
Discovered while running ASP.NET Core tests on the S390x port. Kestrel assumes that custom attribute values are reference-equal to
string.Empty
, not some other empty string value.Testing
Manual testing and CI
Risk
Very low - code would have to rely on Mono's custom attribute implementation to return fresh string objects to be affected.