Hy,

Please, can anyone explain me how method signatures are compared !!!

The two following methods have different signatures and can both
coexist in the same class ClassA

class public ClassA
{
  .method public newslot virtual instance void VMethod(class ClassA i)
cil managed {...}
  .method public newslot virtual instance void VMethod(class
[MyAssembly]ClassA i) cil managed {...}
  ...
}

Now if we define two classes B that both extend the class A and
redefines both methods

class public ClassB extends ClassA
{
  .method public virtual instance void VMethod(class ClassA i) cil
managed {...}
  .method public virtual instance void VMethod(class
[MyAssembly]ClassA i) cil managed {...}
  ...
}

class public ClassC extends ClassA
{
  .method public virtual instance void VMethod(class
[MyAssembly]ClassA i) cil managed {...}
  .method public virtual instance void VMethod(class ClassA i) cil
managed {...}
  ...
}

Note that the classes B and C differ just in the order of method
declaration !

Calling one of the virtual methods of ClassA with an instance of the
class B will always call the
"instance void VMethod(class [MyAssembly]ClassA)". But calling them
with an instance of the class C will always call the "instance void
VMethod(class ClassA)"


I've uploaded a file MethodSignaturesAndOverriding.il so that anyone
can try it.


Please help me out of this nightmare!

-----
PS. Same result on Mono & .Net Framework.
PS. The assembly passes PEVerify check
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to