Why you can't unload an assembly

Josh Holmes and I had dinner with Chris Kinsman last night. He's in town for our .NET User Group meeting tonight. One of the topics that came up was unloading an assembly and the need for a separate AppDomain. We all remembered that there were some blog posts about this but couldn't recall details. I did some googling today and found a couple of relevant posts:

Jason Zander: Why isn't there an Assembly.Unload method?

Suzanne Cook: Unloading an Assembly.

2 Comments



  • Well, first let me say that it was really very nice (*SIC*) of Jason Zander to promise some code samples and not provide any.



    Plus, I tried using Contact off his Blog to send this question, but just received it returned: "recipients failed".



    My question is this: we are having locking issues when all we are doing is simple: using Reflection AssemblyLoad to retrieve Class names and Method names. Once this has been done, say in a (ASP.NET) app, we are frequently having to do an IISRESET in order to update the DLL without getting "file in use" errors. That's just terrible.



  • Cool that you foud the links. Wasn't Rico Mariani or Brad Abrams as I guessed.



    David: That is exactly why you need an appdomain. Load the assembly into it to retrieve your class and method names and then unload the AppDomain.

Comments have been disabled for this content.