Home All Groups Group Topic Archive Search About
Author
30 Jun 2005 5:58 AM
Jody L. Whitlock
Can someone assist me in this quest?  I've been trying in vein for some
time now to figure out how to use AppDomains as a way of making a
plugin architecture.  Basically, here's my plan:

1) Load main assembly
2) Create new appdomain to "discover" all plugins and report them back
to the main assembly
3) Destroy discovery domain (To free assemblies/resources)
4) Create new appdomain and load advertised plugins into it

Now, the reason for this is so that if I have a new plugin, I can
destroy the plugin appdomain, start with step 2, and reload the new
plugins without having to reload the main assembly.  So, I need to
learn how to do a couple of things:
A) Pass objects between appdomains
B) Call methods in my plugins from my main assembly

I plan to use this in a service project, basically all the
functionality of the service is in the plugins, with the main assembly
basically being a loader.  This has been requested because one of the
DLL's the service uses has to be modified every 30 days, so the boos
wants to do this without having to shut down the service.  he can live
with a few seconds interruption.
I plan on leaning heavily on a method I made that resembles CallByName,
plus some static methods.  I also plan on using this in one of my
WinForm apps, making a custom MenuItem object that will also contain
the method to execute.
Here's the kicker, the boss is an old unix programmer, and this whole
thing started because he "heard" somewhere that one can simulate
unix/linux's functionality of CopyMemory to detach a running binary
from the file, update the file, then reattach the binary, effectivly
updating a binary without shutting it down.

So, any pointers?

Thanks,
Jody W

Author
30 Jun 2005 9:04 AM
Carlos J. Quintero [.NET MVP]
There are 3 links about that subject at the bottom of this page of my web
site:

http://www.mztools.com/resources_addin_developers.htm

--
Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

Show quoteHide quote
"Jody L. Whitlock" <tierscheiss1***@hotmail.com> escribió en el mensaje
news:e5pENjTfFHA.1148@TK2MSFTNGP12.phx.gbl...
> Can someone assist me in this quest?  I've been trying in vein for some
> time now to figure out how to use AppDomains as a way of making a
> plugin architecture.  Basically, here's my plan:
>
> 1) Load main assembly
> 2) Create new appdomain to "discover" all plugins and report them back
> to the main assembly
> 3) Destroy discovery domain (To free assemblies/resources)
> 4) Create new appdomain and load advertised plugins into it
>
> Now, the reason for this is so that if I have a new plugin, I can
> destroy the plugin appdomain, start with step 2, and reload the new
> plugins without having to reload the main assembly.  So, I need to
> learn how to do a couple of things:
> A) Pass objects between appdomains
> B) Call methods in my plugins from my main assembly
>
> I plan to use this in a service project, basically all the
> functionality of the service is in the plugins, with the main assembly
> basically being a loader.  This has been requested because one of the
> DLL's the service uses has to be modified every 30 days, so the boos
> wants to do this without having to shut down the service.  he can live
> with a few seconds interruption.
> I plan on leaning heavily on a method I made that resembles CallByName,
> plus some static methods.  I also plan on using this in one of my
> WinForm apps, making a custom MenuItem object that will also contain
> the method to execute.
> Here's the kicker, the boss is an old unix programmer, and this whole
> thing started because he "heard" somewhere that one can simulate
> unix/linux's functionality of CopyMemory to detach a running binary
> from the file, update the file, then reattach the binary, effectivly
> updating a binary without shutting it down.
>
> So, any pointers?
>
> Thanks,
> Jody W
Author
30 Jun 2005 12:30 PM
Herfried K. Wagner [MVP]
Show quote Hide quote
"Jody L. Whitlock" <tierscheiss1***@hotmail.com> schrieb:
> Can someone assist me in this quest?  I've been trying in vein for some
> time now to figure out how to use AppDomains as a way of making a
> plugin architecture.  Basically, here's my plan:
>
> 1) Load main assembly
> 2) Create new appdomain to "discover" all plugins and report them back
> to the main assembly
> 3) Destroy discovery domain (To free assemblies/resources)
> 4) Create new appdomain and load advertised plugins into it
>
> Now, the reason for this is so that if I have a new plugin, I can
> destroy the plugin appdomain, start with step 2, and reload the new
> plugins without having to reload the main assembly.  So, I need to
> learn how to do a couple of things:
> A) Pass objects between appdomains
> B) Call methods in my plugins from my main assembly

AppDomains and Dynamic Loading
<URL:http://msdn.microsoft.com/library/en-us/dncscol/html/csharp05162002.asp>

Plug-in Manager
<URL:http://www.thecodeproject.com/csharp/DynamicPluginManager.asp>

Dynamically executing code in .Net
<URL:http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
5 Jul 2005 5:35 PM
Jody L. Whitlock
Herfried K. Wagner [MVP] wrote:

Show quoteHide quote
> "Jody L. Whitlock" <tierscheiss1***@hotmail.com> schrieb:
> > Can someone assist me in this quest?  I've been trying in vein for
> > some time now to figure out how to use AppDomains as a way of
> > making a plugin architecture.  Basically, here's my plan:
> >
> > 1) Load main assembly
> > 2) Create new appdomain to "discover" all plugins and report them
> > back to the main assembly
> > 3) Destroy discovery domain (To free assemblies/resources)
> > 4) Create new appdomain and load advertised plugins into it
> >
> > Now, the reason for this is so that if I have a new plugin, I can
> > destroy the plugin appdomain, start with step 2, and reload the new
> > plugins without having to reload the main assembly.  So, I need to
> > learn how to do a couple of things:
> > A) Pass objects between appdomains
> > B) Call methods in my plugins from my main assembly
>
> AppDomains and Dynamic Loading
> <url:
> http://msdn.microsoft.com/library/en-us/dncscol/html/csharp05162002.as
> p>
>
> Plug-in Manager
> <url: http://www.thecodeproject.com/csharp/DynamicPluginManager.asp>
>
> Dynamically executing code in .Net
> <url:
> http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm>

Wow, definatly not going to be simple to implement.  Looks like I'm
also going to have to implement Remoting as well, and also translate
all the sample from C# to VB.NET.  Fun, but thanks for the start, it's
more info than I had before.

Thanks,
Jody W
Author
5 Jul 2005 7:51 PM
Herfried K. Wagner [MVP]
Show quote Hide quote
"Jody L. Whitlock" <tierscheiss1***@hotmail.com> schrieb:
>> AppDomains and Dynamic Loading
>> <url:
>> http://msdn.microsoft.com/library/en-us/dncscol/html/csharp05162002.as
>> p>
>>
>> Plug-in Manager
>> <url: http://www.thecodeproject.com/csharp/DynamicPluginManager.asp>
>>
>> Dynamically executing code in .Net
>> <url:
>> http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm>
>
> Wow, definatly not going to be simple to implement.  Looks like I'm
> also going to have to implement Remoting as well, and also translate
> all the sample from C# to VB.NET.  Fun, but thanks for the start, it's
> more info than I had before.

An implementation of loading and unloading application domains can be found
here:

<URL:http://dotnet.mvps.org/dotnet/articles/sharedfinalizer/SharedFinalizer.zip>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>