471,319 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 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 3481
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Lloyd Sheen | last post: by
1 post views Thread by Andy | last post: by
4 posts views Thread by Mirano | last post: by
2 posts views Thread by Lauren Hines | last post: by
1 post views Thread by Luis Pinho | last post: by
6 posts views Thread by Wal Turner | last post: by
2 posts views Thread by brianbender | last post: by
2 posts views Thread by Dominique Vandensteen | last post: by
reply views Thread by rosydwin | last post: by

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.