473,508 Members | 2,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4337
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
1479
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
376
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
2384
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
1899
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
10820
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
11952
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
5323
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
1523
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
8609
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
7324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7382
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
7495
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
5627
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,...
1
5052
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3181
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.