Exception has been thrown by the target of an invocation

C

Curious

Hi,

I get the error, "Exception has been thrown by the target of an
invocation", at the last line of code.

Any idea why this happens and how to get it fixed?

Type mySFunction = Type.GetTypeFromProgID("S-
PLUS.rsi.em");

object splusObject =
Activator.CreateInstance(mySFunction);

object[] oArgs = new object[] { 33, 11, 56, 80 };

// Get error, "Exception has been thrown by the target
of an invocation"
splusObject.GetType().InvokeMember("x",
System.Reflection.BindingFlags.SetProperty, null, splusObject, oArgs);
 
S

Stanimir Stoyanov

There is no way for us to know what is wrong if we do not know what the
called function does. Can you link us to the API or control that you are
using, or at least describe the expected behavior?

In an essence, the error message means that the method you called raised an
exception. If in managed code, it could mean that the exception occurred in
the class contructor.

Hope this helps,
 

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