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

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.Unload 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.Collect
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 2433
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.

"Satinderpal Singh" <sa**********@planetasia.com> wrote in message
news:uu*************@tk2msftngp13.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.Unload 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.Collect
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.ApplicationName="SimpleForm";

SetupInfo.ApplicationBase=@"D:\dotNet\VBApps\AppDo main-Process\bin\Debug";

MyNewDomain = AppDomain.CreateDomain("MyDomain",null,SetupInfo);

Form oHandle = (Form)MyNewDomain.CreateInstanceAndUnwrap("SimpleF orm", "SimpleForm.Form1");

oHandle.Show();

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

AppDomain.Unload(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**************@TK2MSFTNGP10.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.

"Satinderpal Singh" <sa**********@planetasia.com> wrote in message
news:uu*************@tk2msftngp13.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.Unload 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.Collect
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
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...
7
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...
4
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...
8
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...
1
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...
1
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. ...
1
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...
10
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...
1
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,...
4
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...
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
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: 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...
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
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...
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...

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.