T
Terry
I'm building some dll assemblies that have in them the implementation of an
abstract class defined in a different assembly.
I'm trying to create objects of the type defined in the dlls with
"Activator.CreateInstance".
Everything was working fine until I started to fill out the class def with
some implementation. At some point the CreateInstance was failing with a
"MissingMethodException - No parameterless constructor defined for this
object".
I tracked down the problem to an array I was creating in the implementation
of one of the methods.
Specifically, if I create my array like this:
byte [] myByteArray = {0xFF, 0xFF, 0xFF};
it will throw an exception. But, if I create it like this:
byte [] myByteArray = new byte[3];
myByteArray[0] = 0xFF;
etc.
It works fine.
I'm a bit puzzled by this. How can all function local code affect the
creation of an object? And why would it make a difference how the array is
created and initialized within a method of the derived class?
Can anyone help clear this up? Am I doing something I shouldn't be?
Thanks!
abstract class defined in a different assembly.
I'm trying to create objects of the type defined in the dlls with
"Activator.CreateInstance".
Everything was working fine until I started to fill out the class def with
some implementation. At some point the CreateInstance was failing with a
"MissingMethodException - No parameterless constructor defined for this
object".
I tracked down the problem to an array I was creating in the implementation
of one of the methods.
Specifically, if I create my array like this:
byte [] myByteArray = {0xFF, 0xFF, 0xFF};
it will throw an exception. But, if I create it like this:
byte [] myByteArray = new byte[3];
myByteArray[0] = 0xFF;
etc.
It works fine.
I'm a bit puzzled by this. How can all function local code affect the
creation of an object? And why would it make a difference how the array is
created and initialized within a method of the derived class?
Can anyone help clear this up? Am I doing something I shouldn't be?
Thanks!