Release AppDomain Explicit?

  • Thread starter Thread starter xenophon
  • Start date Start date
X

xenophon

I create a seperate AppDomain in code (AppDomain stuff is used in
ASP.NET and elsewhere in a WinForm app),and I want to make sure it
gets released properly. Right now I create it like this:


string binDir = AppDomain.CurrentDomain.BaseDirectory + "bin/" ;
AppDomain domain = AppDomain.CreateDomain(this.AppDomainName , null
, binDir , binDir , false);
ObjectHandle handle = domain.CreateInstance("PlaceIt" ,
"PlaceIt.StoreIt");
codegateway = (Codegateway)handle.Unwrap();

I want to explicitly release this resource when I'm done. Seting
handle and domain to null won't do it, right?

Thanks.
 
I see no reason why the static unload method would not be successful. As a
precaution, wrap the unload call in an exception block catching for
cannotunloadappdomainexception if you must provide a certain level of
robustness.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
 
Back
Top