|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
.NET 3.5 - System.Reflection.Assembly does not release object (DLL) after useDoes 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 Am 01.04.2010 03:20, schrieb Wolfixx:
> Hello, Look at the big "Note" in the middle:> > 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. 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). -- Armin
Show quote
Hide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message Thanks Armin that seems to be a design limitation then.news:O$Kj#sY0KHA.776@TK2MSFTNGP04.phx.gbl... > Am 01.04.2010 03:20, schrieb Wolfixx: >> 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. > > 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). > > -- > Armin Wolfgang
Dynamic Label Control Property in 2008
creating activeX on VB.NET 2008 Executable program while debugging. .net Versions project and solution. .config files are getting corrupted Weird application exit How might one serialize a sorted dictionary? container for tables & queries in VB.NET 2008 A solution! |
|||||||||||||||||||||||