Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Pfister <steveisok@users.noreply.github.com>2019-08-08 13:14:39 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2019-08-08 13:14:39 +0300
commit64ea10fbcd5e526cefcdcb98a60f041a638facfe (patch)
tree156d7e23b23fe7142bb10fa79c76d679f3eb66f9 /mcs/class/referencesource
parentc189afd4f5ccdd5792a09245b5026d8a383c97ec (diff)
Fixed RuntimeType.GetConstructorCandidates("") to return 0 elements. (#16054)
https://github.com/mono/mono/issues/16010 The current behavior for GetConstructorCandidates when the name is null, "", or "*" is to return the set of constructors for the type. For "", .NET Core and .NET Framework return 0 elements. This PR adds a check for "" to match that behavior.
Diffstat (limited to 'mcs/class/referencesource')
-rw-r--r--mcs/class/referencesource/mscorlib/system/rttype.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/mcs/class/referencesource/mscorlib/system/rttype.cs b/mcs/class/referencesource/mscorlib/system/rttype.cs
index 1261359335f..5184305c5aa 100644
--- a/mcs/class/referencesource/mscorlib/system/rttype.cs
+++ b/mcs/class/referencesource/mscorlib/system/rttype.cs
@@ -2858,17 +2858,24 @@ namespace System
return candidates;
}
+ // Note the following assumptions on name:
+ // 1. Callers assume that null == "*"
+ // 2. FilterHelper chops off "*"
+ //
private ListBuilder<ConstructorInfo> GetConstructorCandidates(
string name, BindingFlags bindingAttr, CallingConventions callConv,
Type[] types, bool allowPrefixLookup)
{
bool prefixLookup, ignoreCase;
MemberListType listType;
+
RuntimeType.FilterHelper(bindingAttr, ref name, allowPrefixLookup, out prefixLookup, out ignoreCase, out listType);
-#if MONO
- if (!string.IsNullOrEmpty (name) && name != ConstructorInfo.ConstructorName && name != ConstructorInfo.TypeConstructorName)
+#if MONO
+ if ((!prefixLookup && name?.Length == 0) ||
+ (!string.IsNullOrEmpty (name) && name != ConstructorInfo.ConstructorName && name != ConstructorInfo.TypeConstructorName)) {
return new ListBuilder<ConstructorInfo> (0);
+ }
RuntimeConstructorInfo[] cache = GetConstructors_internal (bindingAttr, this);
#else
RuntimeConstructorInfo[] cache = Cache.GetConstructorList(listType, name);