Home All Groups Group Topic Archive Search About

ReflectionOnlyLoad Issues

Author
8 Jun 2006 4:10 PM
thilbert
I have a problem that is somewhat perplexing.  I am developing a plugin
framework for a third partly application.  The third party's
development team has modified the software to call into my plugin to
initialize it (they will go no further in development as none of their
other customers need the functionality that I am adding).

After initialization of the Plugin, I enumerate the dll's in the apps
directory and determine if they implement the IPlugin interface and if
they do, retrieve a custom attribute that allows me to inject into the
third party app a menu name and the instantiation details for each dll
that inherits from IPlugin.

This works fine if, when enumerating the plugin dlls, I use
Assembly.LoadFrom; however, doing that loads the dll into the AppDomain
and of course, you cannot unload it.  When I attempt to instantiate a
plugin, I get all kinds of weird behavoirs, in part I assume, because
it's already beeen instantiated once.

I then turned to Assembly.ReflectionOnlyLoadFrom but in doing so, it
seems that I can't get the implementation interface from the type, only
the abstract interface so I can't tell if I have the type that defines
the interface or a type that inherits the interface without comparing
the assembly name to a constant, which seems kludgy and inelegant.

After all of this bloviating, the question is, what are the differences
between LoadFrom and ReflectionOnlyLoadFrom that would cause the
differences in behavior noted above ie interface definition vs.
interface implementation?  The docs, as far as I can tell, are not
helpful.

AddThis Social Bookmark Button