Unlimited Technique          Unlimited Wisdom

1001010000101001000010010001000010000101101110111 1101010010010101011110010101110101011010101010101

导航

Two bugs are destroyed.(the one is correlative with hashcode)

 

Today I destroyed two bugs.

1、 When generating the Call method of NestedType, a loading argument error happens.

The method has only an argument: Object[] A_1;  The IL of pushing the argument to evaluation stack should be   IL_0001:  ldarg      A_1.  The source code should be ilGenerator.Emit(OpCodes.Ldarg, 1); not ilGenerator.Emit(OpCodes.Ldarg, i + 1);  in EmitNestedTypes.cs OK.

2、 When generating the NestedType, if the overload methods are present in a class, then an error will be thrown.  The cause is the name of the NestedType is reduplicate. A solution is add a hashcode after the nestedtype names. The source code is following.

        String delegateName = "__delegate__" + methodInfo.Name + "_" + methodInfo.GetHashCode().ToString();    in EmitNestedTypes.cs  OK.

 

       HashCode:

       The default GetHashCode method comes from Object. The code is:

// This is a source code decompiled.
public virtual int GetHashCode()
{
           return object.InternalGetHashCode(this);

} 

           

       InternalGetHashCode is a internal extern method:

internal static extern int InternalGetHashCode(object obj);

 

posted on 2005-07-28 22:33  bughole  阅读(285)  评论(0)    收藏  举报