I am using some .NET assemblies another developer wrote for use from an older VB6 application. They are only used for some of our customers so I am using the Assembly.LoadFrom(file) method and invoking the methods. I am worried about unloading / releasing the objects after I make the calls. Do I need to do something explicitly, or will the garbage collector take care of it automatically?
+5
A:
You can't unload an assembly.
(The closest you can come to that is loading it into an AppDomain
that you then unload.)
Steven Sudit
2010-08-13 22:07:00
Dynamically loading assemblies into a separate AppDomain is actually the correct design pattern. That way, if an unhandled exception is thrown in the dynamically loaded assembly, it is isolated from your application which loaded it. Furthermore, as Steven stated, you can shut down the dynamically loaded AppDomain when needed.
bporter
2010-08-13 22:19:16