[Mono-list] Workaround for AppDomain.Load + Unload problem?
Gonzalo Paniagua Javier
Thu, 28 Aug 2003 04:09:15 +0200
El jue, 28-08-2003 a las 02:06, A Rafael D Teixeira escribiˇ:
> >From: Miguel de Icaza <firstname.lastname@example.org>
> >To: J÷rg Rosenkranz <email@example.com>
> >CC: firstname.lastname@example.org
> >Subject: Re: [Mono-list] Workaround for AppDomain.Load + Unload problem?
> >Date: 27 Aug 2003 18:08:23 -0400
> > > We are creating an application which should be able to load and
> > > unload assemblies at runtime to update parts of it dynamically.
> > > To unload an assembly you have to unload the AppDomain which
> > > is running it. Now there is a problem in loading and unloading
> > > AppDomains:
> > > http://bugzilla.ximian.com/show_bug.cgi?id=47659
> > >
> > > Has someone done something similar and got around this problem?
> > > Is there maybe any workaround?
> >.NET does not support unloading assemblies. It is not an easy problem
> >to fix (neither in .NET nor in Mono).
> That┤s is why most auto-updating solutions, use the
> AppDomain.ShadowCopyFiles property, that makes the appdomain copy all the
> files that are needed to be loaded to a shadow directory, and load them from
> there, leaving the original files available to be superseded. The biggest
> problem is that you one of two choices: if you want to guarantee the user is
> running the latest version always, you need to wait for all assemblies being
> updated before entering the main program (in that case you may not even use
> ShadowCopyFiles), or the update occurs in the background but the user will
> view it reflected only the next time it enters the application.
The MS runtime locks the assemblies. So unless you use ShadowCopyFiles,
you can't overwrite them while the program is running.