TargetInvocationException InnerException:StackOverflowException on Activator.CreateInstance(t);??

2

2G

Hi,

I'm having some problems creating an instance of the dataset I compile in
memory and I don't know why.
I what to do this to Invoke WriteXmlSchema or GetSchemaSerializable so I
could save the xsd of my dataset.
The compiling seems to succeed since cr.Errors.HasErrors returns false;

Anyone that knows what the problem could be?

Assembly a = cr.CompiledAssembly;
Type[] mytypes = a.GetTypes();
foreach(Type t in mytypes)
{
try {
object ibaseObject = Activator.CreateInstance(t);
object[] arguments = new object [] {};
object result;
result = t.InvokeMember ("GetSchemaSerializable",
BindingFlags.Default | BindingFlags.InvokeMethod, null, ibaseObject,
arguments);
}catch(TargetInvocationException ex){
throw ex.InnerException;
}
}


thanks.
 
2

2G

I've added a check to see if it is a dataset but still the same error.

if(t.BaseType == typeof(System.Data.DataSet)){

object ibaseObject = Activator.CreateInstance(t),

object[] arguments = new object [] {};

object result;

result = t.InvokeMember ("GetSchemaSerializable", BindingFlags.Default |
BindingFlags.InvokeMethod, null, ibaseObject, arguments);

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top