+
+ bool NoExactMatch (ResolveContext ec, ref Arguments Arguments, IDictionary<MethodSpec, MethodSpec> candidate_to_form)
+ {
+ AParametersCollection pd = best_candidate.Parameters;
+ int arg_count = Arguments == null ? 0 : Arguments.Count;
+
+ if (arg_count == pd.Count || pd.HasParams) {
+ if (TypeManager.IsGenericMethodDefinition (best_candidate.MetaInfo)) {
+ if (type_arguments == null) {
+ ec.Report.Error (411, loc,
+ "The type arguments for method `{0}' cannot be inferred from " +
+ "the usage. Try specifying the type arguments explicitly",
+ TypeManager.CSharpSignature (best_candidate.MetaInfo));
+ return true;
+ }
+
+ Type[] g_args = TypeManager.GetGenericArguments (best_candidate.MetaInfo);
+ if (type_arguments.Count != g_args.Length) {
+ ec.Report.SymbolRelatedToPreviousError (best_candidate.MetaInfo);
+ ec.Report.Error (305, loc, "Using the generic method `{0}' requires `{1}' type argument(s)",
+ TypeManager.CSharpSignature (best_candidate.MetaInfo),
+ g_args.Length.ToString ());
+ return true;
+ }
+ } else {
+ if (type_arguments != null && !best_candidate.IsGenericMethod) {
+ Error_TypeArgumentsCannotBeUsed (ec.Report, loc);
+ return true;
+ }
+ }
+
+ if (has_inaccessible_candidates_only) {
+ if (InstanceExpression != null && type != ec.CurrentType && TypeManager.IsNestedFamilyAccessible (ec.CurrentType, best_candidate.DeclaringType)) {
+ // Although a derived class can access protected members of
+ // its base class it cannot do so through an instance of the
+ // base class (CS1540). If the qualifier_type is a base of the
+ // ec.CurrentType and the lookup succeeds with the latter one,
+ // then we are in this situation.
+ Error_CannotAccessProtected (ec, loc, best_candidate.MetaInfo, queried_type, ec.CurrentType);
+ } else {
+ ec.Report.SymbolRelatedToPreviousError (best_candidate.MetaInfo);
+ ErrorIsInaccesible (loc, GetSignatureForError (), ec.Report);
+ }
+ }
+
+ bool cand_params = candidate_to_form != null && candidate_to_form.ContainsKey (best_candidate);
+ if (!VerifyArgumentsCompat (ec, ref Arguments, arg_count, best_candidate, cand_params, false, loc))
+ return true;
+
+ if (has_inaccessible_candidates_only)
+ return true;
+ }
+
+ return false;
+ }