Method X from Type Y in Assembly Z does not have a

2020-04-07 03:01发布

问题:

I am very confused!

I have a solution that, when published and deployed gives the me the following error:

Exception information: 
Exception type: HttpException 
Exception message: Method 'GetDemosSubsidiaryById' in type 'DG.Crm.DataAccess.Crm2011WS.Repositories.ReferenceEntitiesRepository' from assembly 'DG.Crm.DataAccess.Crm2011WS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
<stack trace>

Obviously it builds fine and the method is implemented and definitely exists in the library. I have used reflector to check the deployed DLLs and I can't see anything out of the ordinary there either - classes exist, types are there, method is implemented. The particular method it is complaining about isn't even called, either.

I have removed all references and readded them in the solution.

I have recreated DG.Crm.DataAccess.Crm2011WS.Repositories.ReferenceEntitiesRepository by using the the 'Implement Interface' shortcut in Visual Studio.

The solution loads and works fine from within Visual Studio.

What am I missing here or where else can I look for more information?

edit to add on solution structure:

The 2011WS library implements interfaces that live in the Common library. Both are then referenced by the WebApps MVC web application.

回答1:

Just an FYI...i had this same exact error. in my case it turned out to be assembly B being referenced by assembly A that was not in the GAC. the error indicated a problem with assembly A so was a bit misleading.



回答2:

Turns out there was an older version of one of the libraries in the GAC. The issue I had was the library in conflicting was the DTO one, and not those referenced in the error.

So in my instance, be more careful about what lives in the GAC!