Hi,
I'll begin with some example code:
Slice:
class A
{
int ex1;
double ex2;
}
class B extends class A
{
["protected"] long val1;
};
user implementation of c# partial class
public partial class B
{
public B(long _val1)
{
val1=_val1;
}
}
I'm getting System.Reflection.TargetParameterCountException on some builds, but not all. This made for some interesting debugging.
After stepping in to AssemblyUtil.cs, public static object createInstance(Type t), on line 216, the invocation of the constructor is passed an object array of zero length:
return t.GetConstructor(constructor).Invoke(new object[]{});
which would suggest the default constructor, however, in my case, the default constructor isn't always the first in the ConstructorInfo array.
As per the microsoft documentation in:
Type.GetConstructors Method (System)
It states that "The GetConstructors method does not return constructors in a particular order, such as declaration order. Your code must not depend on the order in which constructors are returned, because that order varies."
This probably explains why some builds would work and others didn't.
Cheers,
Rob.

Reply With Quote