473,883 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AppDomain Issue...

Hi All,

I have an EXE, I load the DLL from that exe in a seperate AppDomain. (I have
not given reference to that DLL from the EXE).

Now, i call some commands of that dll from the EXE, and in the background i
try to delete the DLL, it does not allows (fair enough).

Now, I unload that AppDomain using AppDomain.Unloa d method. Now, I try to
delete that DLL from the background it still does not allows, I thought the
reason could be Garbage Collector, but then I used System.GC.Colle ct
immediately after unloading the AppDomain, and also waited for 10-15 mins
before deleting it again, but it still does not allows, then i closed the
EXE and now it allows immediately.

What could be the reason ???

Does AppDomain works only for EXEs or is that we cannot unload an assembly
through AppDomain ???

I read few articles on net, www.gotdotnet.com says you can achieve the above
thing, but they have not given any example. Some articles says, this is not
possible, some says you use ShadowFolder of AppDomain to make this work,
with ShadowFolder it works fine, but i dont want to use it (i mean i dont
want to create a seperate folder and maintain a copy of my dll there).

Can anyone please help me out with this ?

I want to load and unload a DLL from the EXE and the moment I unload the
AppDomain of the DLL it should allow me to delete the DLL. This
functionality is to be achieved for AutoDeploy feature.

Thanks,
Satinder
Nov 22 '05 #1
2 2461
If you are loading the DLL in a separate AppDomain then you should be able
to unload the appdomain and then delete/overwrite the assembly. I do it all
the time; ergo, you are probably not loading the dll in a separate
appdomain. Provide a code sample of how you create the appdomain and load
the dll and someone might be able to determine what the problem is.

"Satinderpa l Singh" <sa**********@p lanetasia.com> wrote in message
news:uu******** *****@tk2msftng p13.phx.gbl...
Hi All,

I have an EXE, I load the DLL from that exe in a seperate AppDomain. (I have not given reference to that DLL from the EXE).

Now, i call some commands of that dll from the EXE, and in the background i try to delete the DLL, it does not allows (fair enough).

Now, I unload that AppDomain using AppDomain.Unloa d method. Now, I try to
delete that DLL from the background it still does not allows, I thought the reason could be Garbage Collector, but then I used System.GC.Colle ct
immediately after unloading the AppDomain, and also waited for 10-15 mins
before deleting it again, but it still does not allows, then i closed the
EXE and now it allows immediately.

What could be the reason ???

Does AppDomain works only for EXEs or is that we cannot unload an assembly
through AppDomain ???

I read few articles on net, www.gotdotnet.com says you can achieve the above thing, but they have not given any example. Some articles says, this is not possible, some says you use ShadowFolder of AppDomain to make this work,
with ShadowFolder it works fine, but i dont want to use it (i mean i dont
want to create a seperate folder and maintain a copy of my dll there).

Can anyone please help me out with this ?

I want to load and unload a DLL from the EXE and the moment I unload the
AppDomain of the DLL it should allow me to delete the DLL. This
functionality is to be achieved for AutoDeploy feature.

Thanks,
Satinder

Nov 22 '05 #2
Hi,

Please find the code:

In the click of Button1:
AppDomainSetup SetupInfo = new AppDomainSetup( );

SetupInfo.Appli cationName="Sim pleForm";

SetupInfo.Appli cationBase=@"D: \dotNet\VBApps\ AppDomain-Process\bin\Deb ug";

MyNewDomain = AppDomain.Creat eDomain("MyDoma in",null,SetupI nfo);

Form oHandle = (Form)MyNewDoma in.CreateInstan ceAndUnwrap("Si mpleForm", "SimpleForm.For m1");

oHandle.Show();

And, in the click event of 2nd button i use:

AppDomain.Unloa d(MyNewDomain);

Clicking button1 shows a form, and clicking 2nd button unloads that form as we unload the domain.

btw, I am using .NET Framework 1.0 version ? has it something to do with the version ???

Thanks in advance,

Satinder


"Dave" <no************ ****@wi.rr.com> wrote in message news:OI******** ******@TK2MSFTN GP10.phx.gbl...
If you are loading the DLL in a separate AppDomain then you should be able
to unload the appdomain and then delete/overwrite the assembly. I do it all
the time; ergo, you are probably not loading the dll in a separate
appdomain. Provide a code sample of how you create the appdomain and load
the dll and someone might be able to determine what the problem is.

"Satinderpa l Singh" <sa**********@p lanetasia.com> wrote in message
news:uu******** *****@tk2msftng p13.phx.gbl...
Hi All,

I have an EXE, I load the DLL from that exe in a seperate AppDomain. (I

have
not given reference to that DLL from the EXE).

Now, i call some commands of that dll from the EXE, and in the background

i
try to delete the DLL, it does not allows (fair enough).

Now, I unload that AppDomain using AppDomain.Unloa d method. Now, I try to
delete that DLL from the background it still does not allows, I thought

the
reason could be Garbage Collector, but then I used System.GC.Colle ct
immediately after unloading the AppDomain, and also waited for 10-15 mins
before deleting it again, but it still does not allows, then i closed the
EXE and now it allows immediately.

What could be the reason ???

Does AppDomain works only for EXEs or is that we cannot unload an assembly
through AppDomain ???

I read few articles on net, www.gotdotnet.com says you can achieve the

above
thing, but they have not given any example. Some articles says, this is

not
possible, some says you use ShadowFolder of AppDomain to make this work,
with ShadowFolder it works fine, but i dont want to use it (i mean i dont
want to create a seperate folder and maintain a copy of my dll there).

Can anyone please help me out with this ?

I want to load and unload a DLL from the EXE and the moment I unload the
AppDomain of the DLL it should allow me to delete the DLL. This
functionality is to be achieved for AutoDeploy feature.

Thanks,
Satinder


Nov 22 '05 #3

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

Similar topics

2
380
by: Satinderpal Singh | last post by:
Hi All, I have an EXE, I load the DLL from that exe in a seperate AppDomain. (I have not given reference to that DLL from the EXE). Now, i call some commands of that dll from the EXE, and in the background i try to delete the DLL, it does not allows (fair enough). Now, I unload that AppDomain using AppDomain.Unload method. Now, I try to delete that DLL from the background it still does not allows, I thought the
7
2387
by: José Joye | last post by:
I have a windows service where I create another appdomains. In the newly created AppDomain, I make use of a C library. If I issue an Abort(1) within this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How could I prevent my main AppDomain to stop when the other stopped?Thanks a lot,José
4
4213
by: stu_pb | last post by:
I am designing a plugin system for a window application using .NET(C# specifically). One of the requirements of the plugin system is to be able to dynamically load/unload plugins. My initial thought was to use System.Reflection.Assembly.Load to load the plugins dynamically. This worked great, but I was left with no way to dynamically unload the plugin. So now I come to creating a new AppDomain for the plugins to reside in, since the...
8
5095
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 =
1
1910
by: BuddyWork | last post by:
I think I've found a possible issue with .Net AppDomain.Unload when using attribute LoaderOptimization.MultiDomain. Here you will need ProcessExplorer from SysInternals to see what assemblies are loaded for a given process. You will need to add the following code into HelloWorld1.cs and compile through the CS compiler. csc HelloWorld1.cs // C# Sample Code
1
1753
by: Andrew Ducker | last post by:
I'm trying to load an assembly into a temporary AppDomain rather than my main AppDomain, so that it can be unloaded later on. However, it's also loading into my main AppDomain at the same time. My code is: AppDomain a = AppDomain.CreateDomain("TestDomain"); a.Load("AppDomainTestAssembly"); and in the Console window I get the following when the second line executes:
1
1598
by: Dan Dorey | last post by:
Hey, I've created a very simple test app to try and fix a problem I'm having. Basically I'm trying to log to a text file from a class in a seperate app domain that I've created. When I first create the AppDomain I'm able to log. However, I have the requirement that I'll have to tear down the AppDomain and then load it back up again. When I do this I no longer get any logging.
10
7607
by: =?Utf-8?B?U3RlZmFuIEJhcmxvdw==?= | last post by:
This has been working perfectly for months. Since we switched from ASP.NET 1.1 to 2.0, we have constant and sporadic issues with updating our applications. Touching the web.config works about 40% of the time to cause an AppDomain to reload and flush all assemblies. Sometimes it works perfectly, but other times some Assemblies are not reloaded into the AppDomain, even after multiple web.config file touches. Sometimes multiple versions...
1
4290
by: Bill Woodruff | last post by:
Visual Studio 2005, .NET FrameWork 2.0, C#, WinForms Application Hi, I've read the recent posts by and to 'Thunderbird' (and learned a lot, thanks, from the usual masters Skeet and Paladino, and others) which involve AppDomains in a remoting scenario, but I think the issue I am working with .... while related ... is sufficiently different to warrant a new thread. I'm also working on a plug-in architecture it's for a WinForms based
4
5344
by: illegal.prime | last post by:
Hi all, I'm getting unexpected results when trying to preload assemblies into an AppDomain I'm creating. Upon creation of the AppDomain - I attach an AssemblyResolve to both my current AppDomain and the new AppDomain I create. I copy all the assemblies/dlls into a new directory and then try loading them all into the new AppDomain using the following: private void LoadAssembliesFromDirectory(AppDomain appDomain, string directory)
0
11151
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10752
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10420
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9582
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7974
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7134
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4619
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4225
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3238
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.