diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs index 3752e61158624..2c7bb900641aa 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs @@ -2769,7 +2769,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn MethodInfo methodInfo = candidates[j]; if (!System.DefaultBinder.CompareMethodSig(methodInfo, firstCandidate)) { - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } } @@ -2837,7 +2837,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn { if (returnType is null) // if we are here we have no args or property type to select over and we have more than one property with that name - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } } @@ -2866,7 +2866,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn if ((bindingAttr & eventInfo.BindingFlags) == eventInfo.BindingFlags) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = eventInfo; } @@ -2896,7 +2896,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn if (match != null) { if (ReferenceEquals(fieldInfo.DeclaringType, match.DeclaringType)) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); if ((match.DeclaringType!.IsInterface) && (fieldInfo.DeclaringType!.IsInterface)) multipleStaticFieldMatches = true; @@ -2908,7 +2908,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn } if (multipleStaticFieldMatches && match!.DeclaringType!.IsInterface) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return match; } @@ -2940,7 +2940,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn if (FilterApplyType(iface, bindingAttr, name, false, ns)) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = iface; } @@ -2969,7 +2969,7 @@ public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(Dyn if (FilterApplyType(nestedType, bindingAttr, name, false, ns)) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = nestedType; } diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Resources/Strings.resx b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Resources/Strings.resx index 84cbca76e08bb..a19d41e9c09d8 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Resources/Strings.resx +++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/Resources/Strings.resx @@ -231,9 +231,6 @@ Member not found. - - Ambiguous match found. - There is no metadata token available for the given member. diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ThunkedApis.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ThunkedApis.cs index 7a50b6f3b19ae..5e78685061b9c 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ThunkedApis.cs +++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ThunkedApis.cs @@ -201,7 +201,7 @@ public sealed override Type GetInterface(string name, bool ignoreCase) if (ns != null && !ns.Equals(ifc.Namespace)) continue; if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = ifc; } return match; diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs index 45c95cfecb5c7..7193fd2cff885 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs +++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.BindingFlags.cs @@ -168,7 +168,7 @@ protected sealed override PropertyInfo GetPropertyImpl(string name, BindingFlags { if (returnType is null) // if we are here we have no args or property type to select over and we have more than one property with that name - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } } diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Resources/Strings.resx b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Resources/Strings.resx index 25fa97370a3f5..dfb2f92a4b27a 100644 --- a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Resources/Strings.resx +++ b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Resources/Strings.resx @@ -132,9 +132,6 @@ Member not found. - - Ambiguous match found. - Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table. @@ -225,4 +222,4 @@ Cannot set initonly static field after its owning type is initialized. - \ No newline at end of file + diff --git a/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs b/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs index 9cd5f01a951e3..1290a00f59c51 100644 --- a/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs +++ b/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs @@ -369,7 +369,7 @@ public sealed override MethodBase BindToMethod( } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); // Reorder (if needed) if (names != null) @@ -515,7 +515,7 @@ public sealed override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo } } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return candidates[currentMin]; } @@ -609,7 +609,7 @@ public sealed override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo } } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return candidates[currentMin]; } @@ -725,7 +725,7 @@ public sealed override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return candidates[currentMin]; } @@ -841,7 +841,7 @@ public sealed override void ReorderArgumentArray(ref object?[] args, object stat continue; if (bestMatch != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); bestMatch = match[i]; } @@ -1128,7 +1128,7 @@ private static int GetHierarchyDepth(Type t) // This can only happen if at least one is vararg or generic. if (currentHierarchyDepth == deepestHierarchy) { - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } // Check to see if this method is on the most derived class. diff --git a/src/libraries/System.Reflection.MetadataLoadContext/src/Resources/Strings.resx b/src/libraries/System.Reflection.MetadataLoadContext/src/Resources/Strings.resx index 6e447252b303c..d5a40f23b3169 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/src/Resources/Strings.resx +++ b/src/libraries/System.Reflection.MetadataLoadContext/src/Resources/Strings.resx @@ -125,9 +125,6 @@ The enum type should contain one and only one instance field. - - Ambiguous match found. - Array may not be empty. @@ -269,4 +266,4 @@ The path '{0}' is not valid. - \ No newline at end of file + diff --git a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/DefaultBinder.cs b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/DefaultBinder.cs index 2160fb5151293..4c0ec188cbfe0 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/DefaultBinder.cs +++ b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/DefaultBinder.cs @@ -138,7 +138,7 @@ public sealed override MethodBase BindToMethod( } } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return candidates[currentMin]; } @@ -257,7 +257,7 @@ public sealed override MethodBase BindToMethod( } if (ambig) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return candidates[currentMin]; } @@ -337,7 +337,7 @@ public sealed override MethodBase BindToMethod( continue; if (bestMatch != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); bestMatch = match[i]; } @@ -602,7 +602,7 @@ private static int GetHierarchyDepth(Type t) // This can only happen if at least one is vararg or generic. if (currentHierarchyDepth == deepestHierarchy) { - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } // Check to see if this method is on the most derived class. diff --git a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/RuntimeTypeInfo.BindingFlags.cs b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/RuntimeTypeInfo.BindingFlags.cs index d2fa6dcbc80e6..8d1be59255ed7 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/RuntimeTypeInfo.BindingFlags.cs +++ b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/RuntimeTypeInfo.BindingFlags.cs @@ -150,7 +150,7 @@ internal abstract partial class RoType { if (returnType is null) // if we are here we have no args or property type to select over and we have more than one property with that name - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } } diff --git a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Types/RoType.GetInterface.cs b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Types/RoType.GetInterface.cs index 7c2d8d662aa99..d7d3d8474d1da 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Types/RoType.GetInterface.cs +++ b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Types/RoType.GetInterface.cs @@ -31,7 +31,7 @@ internal abstract partial class RoType if (ns.Length != 0 && !ns.Equals(ifc.Namespace)) continue; if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = ifc; } return match; diff --git a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs index 95e19d9fb365b..21267d651bc11 100644 --- a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs @@ -797,7 +797,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) { MethodInfo methodInfo = candidates[j]; if (!System.DefaultBinder.CompareMethodSig(methodInfo, firstCandidate)) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } // All the methods have the exact same name and sig so return the most derived one. @@ -868,7 +868,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) { if (returnType is null) // if we are here we have no args or property type to select over and we have more than one property with that name - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); } } @@ -900,7 +900,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) if ((bindingAttr & eventInfo.BindingFlags) == eventInfo.BindingFlags) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = eventInfo; } @@ -929,7 +929,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) if (match != null) { if (ReferenceEquals(fieldInfo.DeclaringType, match.DeclaringType)) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); if ((match.DeclaringType!.IsInterface == true) && (fieldInfo.DeclaringType!.IsInterface == true)) multipleStaticFieldMatches = true; @@ -941,7 +941,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) } if (multipleStaticFieldMatches && match!.DeclaringType!.IsInterface) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); return match; } @@ -991,7 +991,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) if (FilterApplyType(iface, bindingAttr, name, false, ns)) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = iface; } @@ -1019,7 +1019,7 @@ public override MemberInfo[] GetMembers(BindingFlags bindingAttr) if (FilterApplyType(nestedType, bindingAttr, name, false, ns)) { if (match != null) - throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); + throw new AmbiguousMatchException(); match = nestedType; }