unloading assemblies

  • Thread starter Thread starter Peter Strøiman
  • Start date Start date
P

Peter Strøiman

Hi.

I have a system that generates assemblies at runtime, loads them, and
executes code in them.
The assembly is stored in memory until the source is modified, which causes
the assembly to
be regenerated.

To be specific, the source code is stored in a database table with a
timestamp column. When an assembly
is generated, it is stored in a collection along with the timestamp value.
(I store the an Assembly object in the collection).
If the timestsamp is changed in the database, the assembly is regenerated
when needed. The old version is then removed from the
collection and replaced with the new.

As this is a server application that should be able to run indefinately
without being shut-down, more and
more code is loaded into the process which should be unloaded.

I searched for an unload assembly function but I cannot find one. Not in the
Assembly class and neither in the AppDomain class.
I don't suppose removing old Assembly object from the collection will cause
the assembly to be unloaded at GC?
Or is there another way to unload the assembly?

Thanks in advance,
Peter Strøiman
 
I searched for an unload assembly function but I cannot find one. Not in the
Assembly class and neither in the AppDomain class.
Or is there another way to unload the assembly?

You cannot unload a single assembly - you'll have to load the assembly
into a specific AppDomain and unload the whole AppDomain.

Marc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Back
Top