G
Guest
Our app is mainly COM based. We allow .NET plug-ins. When a plug-in is
installed, it receives a COM pointer to the app. The plug-in implements our
IExtensionImpl interface and gets the app pointer through the OnCreate
method...
public void OnCreate(IApplication pApp)...
The plug-in that I'm working on also allows sub-plug-ins. These
sub-plug-ins are simple DLLs that provide methods that are accessed via
Reflection.
Here's my problem... I need to forward the IApplication pointer to the
sub-plug-in. Here's the sub-plug-in Create routine...
public void Create(IApplication app)...
The plug-in calls the sub-plug-in using the following Reflection code...
MethodInfo method = Reflect.GetNamedMethod(type, "Create",
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
Object[] parameters = new Object[1] { m_app }; // m_app was
cached in OnCreate()
Type t1 = parameters[0].GetType();
Type t2 = method.GetParameters()[0].ParameterType;
method.Invoke(testType, parameters);
The Invoke fails with a type mismatch:
t1 = System.__ComObject
t2 = IApplication
How do I get the types to match?
installed, it receives a COM pointer to the app. The plug-in implements our
IExtensionImpl interface and gets the app pointer through the OnCreate
method...
public void OnCreate(IApplication pApp)...
The plug-in that I'm working on also allows sub-plug-ins. These
sub-plug-ins are simple DLLs that provide methods that are accessed via
Reflection.
Here's my problem... I need to forward the IApplication pointer to the
sub-plug-in. Here's the sub-plug-in Create routine...
public void Create(IApplication app)...
The plug-in calls the sub-plug-in using the following Reflection code...
MethodInfo method = Reflect.GetNamedMethod(type, "Create",
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
Object[] parameters = new Object[1] { m_app }; // m_app was
cached in OnCreate()
Type t1 = parameters[0].GetType();
Type t2 = method.GetParameters()[0].ParameterType;
method.Invoke(testType, parameters);
The Invoke fails with a type mismatch:
t1 = System.__ComObject
t2 = IApplication
How do I get the types to match?