AppDomain - Loading a assemly
-
I am creating a testing harness for my app and merrily loading assemblies using reflection into a seperate app domain. What i was hoping to be able to do is unload the App Domain - releasing the file lock on the Assemblies. Allowing me to have write access to rebuild them in Visual Studio. Unfortunately the app still has locks on the assemblies. Can anyone think of what i might be missing? The code goes something like this: 1) Assembly assembly = reflectionDomain.Load(filename); 2) AppDomain.Unload(reflectionDomain); Anyone any clues? Cheers Rich
-
I am creating a testing harness for my app and merrily loading assemblies using reflection into a seperate app domain. What i was hoping to be able to do is unload the App Domain - releasing the file lock on the Assemblies. Allowing me to have write access to rebuild them in Visual Studio. Unfortunately the app still has locks on the assemblies. Can anyone think of what i might be missing? The code goes something like this: 1) Assembly assembly = reflectionDomain.Load(filename); 2) AppDomain.Unload(reflectionDomain); Anyone any clues? Cheers Rich
There is a known issue with file locks when images are involved. Image.FromFile(fileSpec) keeps fileSpec open; a work-around consists of a small class that immediately copies the image to another image, and then disposes of the original. Maybe that's what you are experiencing... :)
Luc Pattyn