473,385 Members | 1,324 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,385 software developers and data experts.

Assembly.LoadFrom(...)

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 Assembly.LoadFrom(assemblyname).
After loading, it walks through all types in the assembly looking for a
info-object. When this info-object is found, then it should be a known
plugin-assemlby.

My question is how to unload these assemblies?

Kind regards,
Henrik
Nov 18 '05 #1
2 1514
Hi Henrik:

Unfortunately you can't unload an assembly. MS gives several reasons
for this, one being that the runtime can't be sure there isn't some
thread still executing code in the assembly. The runtime would also
have to go throw the memory heap used by the JIT and remove compiled
methods to completely unload an assembly, and the design just isn't
optimized for this scenario - it's optimized for adding new compiled
methods.

The workaround is to create a new application domain for your
plug-ins, and unload the app domain. This has a price to pay in
performance because you've introduced a remoting boundary.

HTH,

--
Scott
http://www.OdeToCode.com

On Thu, 8 Jul 2004 11:50:52 +0200, "Henrik de Jong" <nn@nnnnnn.nl>
wrote:
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 Assembly.LoadFrom(assemblyname).
After loading, it walks through all types in the assembly looking for a
info-object. When this info-object is found, then it should be a known
plugin-assemlby.

My question is how to unload these assemblies?

Kind regards,
Henrik


Nov 18 '05 #2
Hi,

you simply can't. here explanation of one of the CLR team :
http://weblogs.asp.net/jasonz/archiv...31/145105.aspx

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

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

Similar topics

2
by: aerge calderara | last post by:
dear all, I am using the GetTypes method of an assembly object in order to check that it implement a particular needed interface for my application. ...
4
by: Arnaud Debaene | last post by:
Hello group. I have an app which can load "plugins" assemblies that are described in the registry (each registry entry gives the full path to the plugin ..dll file). The plugins may be anywhere...
2
by: Greg Bacchus | last post by:
Hi, Does anyone know how to get an offline reference to an assembly that has been downloaded using Assembly.LoadFrom. E.g. Application downloads the assembly while it in online... next time it...
1
by: Benjamin | last post by:
Hi, I'm currently writing a Web Services that interacts with a database. To allow me to use not just one database provider (for example, I could use MS Access, SQL Server or MySQL), the Web...
11
by: Michael Maes | last post by:
Hello, I want to be able to load an assembly by selecting a dll from an OpenFileDialog. This seems to work, exept when that assembly references "3rd-Party dll's". Just this simple line: Dim...
1
by: Gujju | last post by:
Hi all, Whats the difference betwn Assembly.Load(FileName) and Assembly.LoadFrom(FileName.dll) ? Cheers C
1
by: lgbjr | last post by:
Hi All, I am moving some of my MDI Child forms to DLLs. The first 3 forms worked fine. But the 4th one is causing me some grief! I use the following code to load a form from a DLL: Dim...
6
by: Steve | last post by:
I'm playing with late binding and trying a very simple test to load an assembly In my "Host" application I have this code: <code> string modulePath =...
4
by: =?Utf-8?B?SmFu?= | last post by:
I have a .NET 2.0 application divided in two assemblies; the exe and a dll. The application generates a plugin-dll which is then loaded in a separate AppDomain (along with a second instance of my...
2
by: stokiemike | last post by:
I need to unload my loaded assembly. I have used LoadFrom to give me the flexability of loading the dll from any location. However, to totally remove the assembly I need to unload the AppDomain,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.