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

How to unload an assembly

MyEXE loads myDLL at runtime using Assembly.LoadFile("myDLL.dll").

Then I create an instance of a class contained in MyDLL using Reflection.

When I terminate the debug session of my EXE file, the DLL remains locked
and cannot be overwritten. I can only exit VS and reload.

Is there any command which can force releasing the DLL module? Any idea?

Thanks,
Fabio
Dec 29 '05 #1
5 3578
Fabio,

If you do not have "Process explorer" (PE), download it and run it:
http://www.sysinternals.com/Utilitie...sExplorer.html

After running your application, verify that the process that loaded
"myDLL.dll" is shutdown. If PE is visible while the process dies, PE
will indicate it in red. This step is important. I suspect that you
are still debugging the process or that it is not dieing for some
reason.

If the process has indeed shutdown, but the DLL is still locked, use
the "Find" > "Find Handle..." function in PE to determine what is
locking the DLL.

Colin Neller
http://colinneller.com/blog

Dec 29 '05 #2
Hi Colin.
That was interesting. myDLL gets loaded into DEVENV (VS) as soon I open the
solution. Even if I do not open the Designer, and I cancel any refernce to
it from the Toolbox. I wonder why is that...

"Colin Neller" <cn*****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Fabio,

If you do not have "Process explorer" (PE), download it and run it:
http://www.sysinternals.com/Utilitie...sExplorer.html

After running your application, verify that the process that loaded
"myDLL.dll" is shutdown. If PE is visible while the process dies, PE
will indicate it in red. This step is important. I suspect that you
are still debugging the process or that it is not dieing for some
reason.

If the process has indeed shutdown, but the DLL is still locked, use
the "Find" > "Find Handle..." function in PE to determine what is
locking the DLL.

Colin Neller
http://colinneller.com/blog

Dec 30 '05 #3

"Fabio Cannizzo" <fc*****************@london.edu> wrote in message
news:43**********************@reader1.news.tin.it. ..
Hi Colin.
That was interesting. myDLL gets loaded into DEVENV (VS) as soon I open
the solution. Even if I do not open the Designer, and I cancel any
refernce to it from the Toolbox. I wonder why is that...

"Colin Neller" <cn*****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Fabio,

If you do not have "Process explorer" (PE), download it and run it:
http://www.sysinternals.com/Utilitie...sExplorer.html

After running your application, verify that the process that loaded
"myDLL.dll" is shutdown. If PE is visible while the process dies, PE
will indicate it in red. This step is important. I suspect that you
are still debugging the process or that it is not dieing for some
reason.

If the process has indeed shutdown, but the DLL is still locked, use
the "Find" > "Find Handle..." function in PE to determine what is
locking the DLL.

Colin Neller
http://colinneller.com/blog



Suppusing you are using VS2005, right?
This is because you are using the "hosting process" to run your code in the
debugger, this process keeps running, even after you quit the application.

Willy.

Dec 30 '05 #4
I am using VS2003.
Fabio

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...

"Fabio Cannizzo" <fc*****************@london.edu> wrote in message
news:43**********************@reader1.news.tin.it. ..
Hi Colin.
That was interesting. myDLL gets loaded into DEVENV (VS) as soon I open
the solution. Even if I do not open the Designer, and I cancel any
refernce to it from the Toolbox. I wonder why is that...

"Colin Neller" <cn*****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Fabio,

If you do not have "Process explorer" (PE), download it and run it:
http://www.sysinternals.com/Utilitie...sExplorer.html

After running your application, verify that the process that loaded
"myDLL.dll" is shutdown. If PE is visible while the process dies, PE
will indicate it in red. This step is important. I suspect that you
are still debugging the process or that it is not dieing for some
reason.

If the process has indeed shutdown, but the DLL is still locked, use
the "Find" > "Find Handle..." function in PE to determine what is
locking the DLL.

Colin Neller
http://colinneller.com/blog



Suppusing you are using VS2005, right?
This is because you are using the "hosting process" to run your code in
the debugger, this process keeps running, even after you quit the
application.

Willy.

Dec 30 '05 #5

"Fabio Cannizzo" <fc*****************@london.edu> wrote in message
news:43**********************@reader1.news.tin.it. ..
I am using VS2003.
Fabio


Oh I see, what kind of DLL is this? I'm not clear on why DEVENV (vs) would
attach a DLL which is not part of it's toolbox or used by it's designers
(unless this is a bug in vs2003).

Willy.

Dec 30 '05 #6

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

Similar topics

0
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...
0
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
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...
4
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...
2
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
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
by: Sam Martin | last post by:
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...
6
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...
2
by: brianbender | last post by:
I am trying to load and unload assemblies dynamically and call methods and properties when loaded into an Appdomain I can load assemblies all day in the current AppDomain without references and...
2
by: Dominique Vandensteen | last post by:
I want to make a program that checks for updates at start... The way I am doing this is to create 2 projects... A simple exe checks the server for the version and downloads a dll if needed. The...
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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.