From: Family Tree Mike on


"Wolfixx" wrote:

> Hello,
>
> Does anyone of you know how I can force vb.net to remove the handle of a
> local DLL which I used beforehand with Reflection.
>
> Here is a fragment of the code.
> I have a base class and a derived class. This app only knows the base class
> and creates an Instance of the derived class by using Reflection which works
> fine. The only problem I have is that the local DLL file is blocked (I can't
> delete it) as long as I don't close the Application
>
> Dim GetCustomModule as BaseClass
> Dim dll As Assembly =
> Assembly.LoadFrom("c:\tools\DerivedCass.dll")
> For Each assemblytype As System.Type In dll.GetExportedTypes
> If assemblytype.ToString = "tools" Then
> GetCustomModule =
> DirectCast(Activator.CreateInstance(assemblytype), BaseClass)
> End If
> Next
> ....
> do something with the Class and then get rid of it
> ....
>
> dll = Nothing
> 'now the file c:\tools\DerivedCass.dll is still locked and I can't delete
> it.
>
> Forcing Garbage Collector to run doesn't help at all. I can see through
> Sysinternals\ProcessExplorer that AppName.vshost.exe has still a handle on
> that file.
>
> Thanks for any help
> Wolfgang
>
>
> .
>

Armin Zingler responded to your post in the VB.Net group several days ago.
From his post:

Look at the big "Note" in the middle:
http://msdn.microsoft.com/en-us/library/2bh4z9hs.aspx

I've no experience with it but maybe you find something
in the neighbour topics (about assemblies and application domains).


From: Wolfixx on

> Armin Zingler responded to your post in the VB.Net group several days ago.
> From his post:
>
> Look at the big "Note" in the middle:
> http://msdn.microsoft.com/en-us/library/2bh4z9hs.aspx
>
> I've no experience with it but maybe you find something
> in the neighbour topics (about assemblies and application domains).
>
>

Yes I know but the answer doesn't help me. I though it belong to this
newsgroup anyway because it is an issue with the .Net Framework and not VB
specific.
Any other ideas?

From: Wolfixx on
"Wolfixx" <wolfixx(a)gmx.at> wrote in message
news:#bTCOx51KHA.4832(a)TK2MSFTNGP04.phx.gbl...
>
>> Armin Zingler responded to your post in the VB.Net group several days
>> ago.
>> From his post:
>>
>> Look at the big "Note" in the middle:
>> http://msdn.microsoft.com/en-us/library/2bh4z9hs.aspx
>>
>> I've no experience with it but maybe you find something
>> in the neighbour topics (about assemblies and application domains).
>>
>>
>
> Yes I know but the answer doesn't help me. I though it belong to this
> newsgroup anyway because it is an issue with the .Net Framework and not VB
> specific.
> Any other ideas?
Ignore me. The answer fitted - it's just not possible