473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

The good old Assembly.Unload() that doesn't exist

Morning all,

Right, I've read untold articles now, listening to people bitch about there
being no Unload method for Assembly.
Plenty of people do counter that this is possible by loading the Assemblies
into a seperate AppDomain and closing it when finish, which would suit me
fine.

However, I have been able to find an example.

What i'm trying to do, is from my application, load an assembly(s) itterate
through certain types and then "unload" the assembly(s) thenopen another
assembly(s) and do the same. The type information etc. must be available
from my main application.

How do i do this? surely i cannot get to this information from another
AppDomain?

Any pointers welcome,

TIA
Sam
Nov 16 '05 #1
2 4330
ok, so i think i've answered this one myself too.

what i need to do is create an assembly that does the work i need to to on
the types and attributes of the additional assemblies i need it to.

Before i wanted to load an assembly, look at the types and their attributes
(using reflection), do "stuff" then unload the assembly.

Now i need to create a new assembly that does the "stuff" - i'll call this
the StuffDoer - on the extra assemblies that's loaded with them in a their
own app domain.

The shell application (in it's own app domain) becomes like the "stuff"
manager - StuffManager - that instead of just loading a single assembly,
browing types and attribs via reflection and doing "stuff". Actually
creates a new AppDomain, loads the StuffDoer assembly along with the extra
assembly(s) that are to browsed before "stuff" can be done.

so before, my application loaded an assembly, looked at type and attrib info
via reflection and did stuff with it... but couldn't unload the assmebly.

now, my main app, StuffManager, creates an AppDomain, load the StuffDoer and
additional assmeblies. StuffManager then executes code in the StuffDoer the
does the stuff, then StuffManager closes the new AppDomain and is ready for
a new assembly(s).

Executing the code in the other AppDomain (i.e. executing the StuffDoer)
I haven't done this yet, but found a good article,
http://blogs.msdn.com/suzcook/archiv.../12/57169.aspx
Tells you how to do it there.
HTH anyone facing similar prob

sam


"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:es**************@TK2MSFTNGP11.phx.gbl...
Morning all,

Right, I've read untold articles now, listening to people bitch about there being no Unload method for Assembly.
Plenty of people do counter that this is possible by loading the Assemblies into a seperate AppDomain and closing it when finish, which would suit me
fine.

However, I have been able to find an example.

What i'm trying to do, is from my application, load an assembly(s) itterate through certain types and then "unload" the assembly(s) thenopen another
assembly(s) and do the same. The type information etc. must be available
from my main application.

How do i do this? surely i cannot get to this information from another
AppDomain?

Any pointers welcome,

TIA
Sam

Nov 16 '05 #2
Just a caution on using other AppDomains. I believe all method calls
between the domains are serialized. This can give a big performance hit.
We experimented with this because we need an application environment
that runs 24-7-365. We need a way to load and unload plug in code type
objects on the fly as a way for enhancement and bug fixing. We can't
shut it down and restart it. We could find no way to do this with
Microsoft's CLR that had high performance :( We discussed this with
Microsoft and they agreed that they had no solution and say maybe
sometime in the future. Seems a strange oversite since they had Java as
a model. You can do this with custom class loaders in Java.

Leon Lambert

Sam Martin wrote:
Morning all,

Right, I've read untold articles now, listening to people bitch about there
being no Unload method for Assembly.
Plenty of people do counter that this is possible by loading the Assemblies
into a seperate AppDomain and closing it when finish, which would suit me
fine.

However, I have been able to find an example.

What i'm trying to do, is from my application, load an assembly(s) itterate
through certain types and then "unload" the assembly(s) thenopen another
assembly(s) and do the same. The type information etc. must be available
from my main application.

How do i do this? surely i cannot get to this information from another
AppDomain?

Any pointers welcome,

TIA
Sam

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lloyd Sheen | last post by:
I am having trouble gettting an assembly loaded with Assembly.LoadFrom. I can get the assembly call the method I need to call. Now I want to unload the assembly. I need to do this so that the...
1
by: Chris Dunaway | last post by:
I'm using the ICodeCompiler.CompileAssemblyFromSource method to compile a VB class dynamically. The problem is that when I create an instance of the resulting class, it loads the assembly. If I...
2
by: mdb | last post by:
I'm trying to develop an application who's GUI will be changing frequently, used by hundreds of people in a corporation. In order to support this, I've created a small .NET web page that loads...
1
by: Andy | last post by:
Hi everybody, i´m working on an application that loads different modules (dll files) via an assembly. I check the build version in that dll file and if a newer version exists, i want to update...
2
by: Lauren Hines | last post by:
Hello, I have read numerous post stating that the only way to unload an assembly (DLL in my case) is to create a separate AppDomain, load the assembly, then unload it by calling AppDomain.Unload....
1
by: Luis Pinho | last post by:
Hi There, I've got a server that is waiting for requests, these request correspond to calls to objects that are specified in assemblies stored in the GAC. To do this, I use reflection to call...
2
by: Razzie | last post by:
Hey all, I'm working on this project where I'm dynamically loading an assembly. Basically what I want is that I can just replace my old dll file with a new one without having to do anything...
2
by: Henrik de Jong | last post by:
I'm using a sort of plugin mechanism in combination with a commandfactory (pluginfactory). This factory looks in a special dir when it's starting. Each assembly(*.dll) will be loaded with...
11
by: Timofmars | last post by:
I'm try to Unload DB2 data from a table into a record sequential file on NT. I can an unload on Mainframe, but it doesn't seem to be an option in NT. In NT, all I can do is export/import. I can...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.