Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

596
Vistas
C# compiler: CS0121: The call is ambiguous between the following methods or properties

This is the craziest what I've seen since a Fody plugin ruined my assembly by emitting invalid code and control flow varied random at runtime... No Fody this time.

Facts:

  • The whole story is within one project.
  • The GetMessage extension method is there since weeks...
  • The issue is started since 2 hours, and I can not figure out what it is.
  • There is only one GetMessage extension method.
  • The error message (see the pic) lists two identical method specification

    Error CS0121 The call is ambiguous between the following methods or properties: 'ComiCalc.Data.ExceptionExtensions.GetMessage2(System.Exception)' and 'ComiCalc.Data.ExceptionExtensions.GetMessage2(System.Exception)' ComiCalc.Data D:\2014Develop\.vsonline\ComiCalc\src\ComiCalc.Data\Services\UserService.cs 61

  • If I change both the call, both the method definition (only 2 edits in 2 places) to GetMessage2, then I got exactly the same error message just referring to the GetMessage2.

  • Using VS 2015

Any ideas?

enter image description here

and here is the single one method:

namespace ComiCalc.Data
{

    using System;
    using System.Data.Entity.Validation;
    using PluralTouch.DataAccess;
    // TODO: Move to PluralTouch
    public static class ExceptionExtensions
    {
        public static string GetMessage2(this Exception exception)
        {

            var message = exception.Message;
            if (exception is DbEntityValidationException)
            {
                message = ((DbEntityValidationException) exception).DbEntityValidationResultToString();
            }
            return message;
        }
    }
}

enter image description here

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Make sure you don't reference the output binary in your project references (i.e., the project references itself). This has happened to me in the past with Resharper (the addition of the output binary to the project references), so the extension method is both in the source and in the binary reference.

over 4 years ago · Santiago Trujillo Denunciar

0

Delete bin folder > open project > build solution.

over 4 years ago · Santiago Trujillo Denunciar

0

Got the same error because my project referenced to a dll, and at the same time had a transitive dependency to the same dll but at different file path.

Spotted it using extra logging during the build (Tools -> Options -> Build and Run ->output verbosity to Detailed or Diagnostic) by searching for dependency dll name: in Task "Csc" there were two occurrences of /reference with the dll

Fix was to point references to the same dll path

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda