473,563 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using AppDomain to load an assembly

I am using reflection to load an assembly dynamically at runtime. If there
are classes in the assembly that implement a particular interface, I put an
entry in a list for later use.

My questions concerns the loading of the assembly. Since there is no way
to unload the assembly, what happens if a assembly I have loaded does not
contain any classes that implement my interface? Does the assembly just
hang around until the app ends? Does it really matter?

I wish to avoid this if possible and I read that to be able to unload an
assembly, you have to use an AppDomain. I have been unable to find a
clear, simple example that shows this.

Can anyone help?

--
Chris

dunawayc[AT]sbcglobal_lunch meat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 21 '05 #1
2 1574
On Fri, 1 Oct 2004 10:17:22 -0500, Chris Dunaway wrote:
I am using reflection to load an assembly dynamically at runtime. If there
are classes in the assembly that implement a particular interface, I put an
entry in a list for later use.

My questions concerns the loading of the assembly. Since there is no way
to unload the assembly, what happens if a assembly I have loaded does not
contain any classes that implement my interface? Does the assembly just
hang around until the app ends? Does it really matter?

I wish to avoid this if possible and I read that to be able to unload an
assembly, you have to use an AppDomain. I have been unable to find a
clear, simple example that shows this.

Can anyone help?


Wouldn't you know it, as soon as I post a request, I find an answer. Here
it is for others with this question:

http://msdn.microsoft.com/library/de...forplugins.asp

--
Chris

dunawayc[AT]sbcglobal_lunch meat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 21 '05 #2
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcg lobal[dot]]net"> schrieb:
[Unloading assemblies]
I wish to avoid this if possible and I read that to be able to unload an
assembly, you have to use an AppDomain. I have been unable to find a
clear, simple example that shows this.


Do you speak C#?

<URL:http://www.codeproject .com/csharp/livecodedotnet. asp>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #3

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

Similar topics

2
3112
by: Foehammer | last post by:
Hello, I'm trying to load an assembly dynamically using an app domain. This is a proof-of-concept for a larger project, so please excuse the lame class names. TestLib is the dll where all the dynamic loading code will go. The assemblies being dynamically loaded do not contain any code. They are resource-only assemblies. I have succeeded in...
4
6084
by: Mirano | last post by:
Hi everybody. I load an assembly into another AppDomain, not a default one. As there is no way to unload the assembly, I need to unload the domain. This is where the app hangs. The problem is this assembly has references to one dll, currently not performing any work. I tried this: 1. Setting the assembly to null, 2. Implementing a...
2
10831
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. When trying to delete the DLL file I get an exception that access is denied. When trying to copy over the DLL file, I get an exception that it is...
8
5078
by: A. Elamiri | last post by:
Hello, I created a small app which acts as a services manager. I basically drop a DLL in a Services folder and set the frequency through the application for how often do I want the code in the assembly to run (scheduler). I created a seperate AppDomain here is the code: .... AppDomainSetup ads = new AppDomainSetup(); string path =
6
8184
by: Wal Turner | last post by:
Hi there. There are various snippets on forums regarding issues with AppDomain.Unload and how it just doesnt work. Fortunately, I got it working with the base case, after much fiddling. Consider this 5 line program: AppDomain domain = AppDomain.CreateDomain("MyDomain"); domain.CreateInstance("TempDLL", "TempDLL.Class1");...
1
2421
by: John | last post by:
Hi, I tried to load a mixedmode dll (MC++) with AppDomain.Load(Byte ) in a C# Client. During the Load Process I got the following Exception: System.IO.FileLoadException: Ausnahme von HRESULT: 0x80131019. at System.Reflection.Assembly.nLoadImage(Byte rawAssembly, Byte rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark) at...
3
22115
by: Frank Uray | last post by:
Hi all I have a problem with loading a assembly ... I am trying to do the following: - I have a directory with a dll (assembly) in it (not the currect dir.) - I am trying to load this assembly, run a method in it, and than close it. The question would be: How is the right way to do it ????
1
3847
by: Basti | last post by:
Hello, I'm working with .Net 2.0. I tried to get attributes of an unloaded assembly. So, the sole way I know is to create a new child application domain, in this app domain I load the assembly, read out the attributes, and unload the child app domain. But in this moment, I load the assembly into the child app domain, the assembly occurs in...
2
5551
by: Tim | last post by:
Hello, I've finally managed to remotely load a DLL. I've expanded the code to load it in a seperate domain to unload the appdomain, which works to a certain extend. The host application always keeps the entry DLL in memory. How can I also unload this main DLL? As it's left after unloading the appdomain. The dll is loaded in the...
2
1420
by: =?Utf-8?B?UGFi?= | last post by:
Hello, I am confused with load assembly in AppDomain. I created ASP Web application, same business logic is realized in custom DLLs, and I need to load ones in my application. If I use ‘Load(assmblyRef)’ method of AppDomain class, assembly is loaded but DLL file locked. I try to read DLL in byte array and load assembly calling...
0
7665
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
924
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.