Release AppDomain Explicit?

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.
 
A

Alvin Bruney [ASP.NET MVP]

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
_________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top