PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Unloading assemblies

Reply

Unloading assemblies

 
Thread Tools Rate Thread
Old 30-06-2003, 10:56 AM   #1
Dmitry Shaporenkov
Guest
 
Posts: n/a
Default Unloading assemblies


Hi all,
I'm developing a tool that explores contents of
assemblies via reflection. When the tool is requested to
get some information from an assembly, it loads the
assembly and reads the information. I would like unload
the assembly immediately after to prevent it from locking
and give the client a possibility to update it. Is there
any way to do this? System.Assembly class has no Unload
method, so I create separate application domain and load
the assembly in this domain. Then I unload the entire
domain by AppDomain.Unload call. However it seems that
the loaded assemblies are still locked even after
unloading the domain.

Has anybody ideas about the reasons of such behavior? Or
can anyone suggest other ways to solve the problem?

Thanks,
Dmitry Shaporenkov


  Reply With Quote
Old 30-06-2003, 11:14 AM   #2
Dave
Guest
 
Posts: n/a
Default Re: Unloading assemblies

Make sure that you are doing all the reflection work in the other appdomain.
If you return references to types or assemblies from the other appdomain to
the default appdomain this has the effect of loading the assembly into both
appdomains.

"Dmitry Shaporenkov" <dsha1980@yahoo.com> wrote in message
news:07b701c33eed$e967a180$a101280a@phx.gbl...
> Hi all,
> I'm developing a tool that explores contents of
> assemblies via reflection. When the tool is requested to
> get some information from an assembly, it loads the
> assembly and reads the information. I would like unload
> the assembly immediately after to prevent it from locking
> and give the client a possibility to update it. Is there
> any way to do this? System.Assembly class has no Unload
> method, so I create separate application domain and load
> the assembly in this domain. Then I unload the entire
> domain by AppDomain.Unload call. However it seems that
> the loaded assemblies are still locked even after
> unloading the domain.
>
> Has anybody ideas about the reasons of such behavior? Or
> can anyone suggest other ways to solve the problem?
>
> Thanks,
> Dmitry Shaporenkov
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off