Blog: Assembly

Avoiding DLL file locks when using .NET reflection in external assemblies

September 6, 2015, (updated on January 7, 2016), Software Development

For one of my projects, I had to load external assemblies and query the exported types (i.e. the public classes) using reflection. Everything worked fine, except that the .DLL files were being locked until the application was terminated. The problem is, that once you load an assembly into the main AppDomain using Assembly.LoadFrom(), it stays loaded and you cannot unload the assembly. Also, loading an assembly into the AppDomain where your other code is running might have unexpected side effects. To avoid all these problems, we need to do the work in a secondary, isolated AppDomain. An AppDomain is like […] Read more...

Tags: , , , , ,


  Page 1 of 1