B
Boni
Hi,
I got this problem. I'm implementing a pluggable winform program. My plugins
are usercontrol and I load them in my program through a interface.
Now if I close my application an error occurs: "Object is currently in use
elsewhere". If I comment the line where a I use the Activator.CreateInstance
it doesn't happen.
I tried to disposed the object created but nothing but If I do a simple
new of my object without using reflection it doesn't give me an error.
can someone help me?
thank's
Here my code,
System.Reflection.Assembly asm =
System.Reflection.Assembly.LoadFrom(fileName);
foreach (Type Ty in asm.GetTypes())
{
if (Ty.GetInterface("IPreviewControls") != null)
{
Plugins.Preview.IPreviewControls plugin =
(Plugins.Preview.IPreviewControls)Activator.CreateInstance(Ty);
}
}
I got this problem. I'm implementing a pluggable winform program. My plugins
are usercontrol and I load them in my program through a interface.
Now if I close my application an error occurs: "Object is currently in use
elsewhere". If I comment the line where a I use the Activator.CreateInstance
it doesn't happen.
I tried to disposed the object created but nothing but If I do a simple
new of my object without using reflection it doesn't give me an error.
can someone help me?
thank's
Here my code,
System.Reflection.Assembly asm =
System.Reflection.Assembly.LoadFrom(fileName);
foreach (Type Ty in asm.GetTypes())
{
if (Ty.GetInterface("IPreviewControls") != null)
{
Plugins.Preview.IPreviewControls plugin =
(Plugins.Preview.IPreviewControls)Activator.CreateInstance(Ty);
}
}