-
May 31st, 2012, 01:18 AM
#1
Unable to invoke method during reflection
I am trying to load the assembly from GAC(third party tool), because i need to load the assembly only if it is particular version , and i am trying to invoke a method in it, but it is throwing TargetInvocationException
PFC below
a = Assembly.LoadFrom("C:\\WINDOWS\\assembly\\GAC\\ESRI.ArcGIS.AxReaderControl\\9.1.0.722__8fc3cc631e44ad86\\ESRI.ArcGIS.AxReaderControl.dll");
AppDomain.CurrentDomain.Load(a.GetName());
Type myType = a.GetTypes()[0];
MethodInfo myMethod = myType.GetMethod("CheckDocument");
object obj = a.CreateInstance(myType.FullName);
object[] objparam2 = new object[1];
foreach (ParameterInfo param in myMethod.GetParameters())
{
objparam2[0] = "testr";
}
try
{
object x = (bool)myMethod.Invoke(obj, objparam2);
}
catch (TargetInvocationException tie)
{
if (tie.InnerException is NotImplementedException)
{
//I am getting the inner exception as System.Windows.Forms.AxHost+InvalidActiveXStateException
}
}
kindly help me in resolving th same . thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|