6

I am using the program Reflexil to inject a reference in the executable Foo1.exe to an outside assembly named Foo2.dll.

In Foo1.exe, there is a class called Bar.

In Foo2.dll, there is an interface IBar which correctly implements all of the fields and methods of Bar.

I have used Reflexil to give Bar in Foo1.exe the interface IBar in Foo2.dll.

When Foo1.exe loads, it finds Foo2.dll located in the application directory and loads it, but it throws a System.TypeLoadException with the following error message Method 'get_***' in type 'Foo1.Bar' from assembly 'Foo1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

I have already read through the previous question with the same error message (TypeLoadException says 'no implementation', but it is implemented), but I've been unable to figure out how to correctly implement the fix when I don't have any compiler checks for Foo1.exe.

Thanks for your help!

0

1 Answer 1

5

I've got the same error message in the following situation: A.dll depends on B.dll, B.dll depends on C.dll and C.dll is not found. In my case A.dll contains a class C2 derived from abstract class C1 located in the same assembly and in the same dll - A.dll. C1 is derived from C0 class from B.dll. C0 has abstract property with abstract getter method, C1 has an implementation of this property but the matter is that return type of the property's getter is defined in the absent library C.dll. Finaly, it leads to the error message "Method 'get_Prop' in type 'C2' from assembly 'A, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxx' does not have an implementation." which is rather irrelevant in this situation. In short the source code looks like this:

C.dll:

namespace C {
  public enum PropType {V1 = 0, V2 = 1, ...}
}

B.dll:

using C;
namespace B {
  public abstract class C0 {
    ...
    public abstract C.PropType Prop {get;}
  }
}

A.dll:

using C;
using B;
namespace A {
  public abstract class C1 : B.C0 {
    ...
    // Getter implementation
    public override C.PropType Prop { get {return C.PropType.V1;}}
  }
}

using C;
using B;
namespace A {
  // Class implementation
  public class C2 : C1 {
    ...
  }
}

So the solution is to add C.dll to the installation.

Not the answer you're looking for? Browse other questions tagged or ask your own question.