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);
浙公网安备 33010602011771号