469,133 Members | 1,015 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,133 developers. It's quick & easy.

working with multiple app domains

I have this interesting problem. I am creating multiple domains using AppDomain.ExecuteAssembly. I created domains App1, App2 and App3 (in the same order). If I close App1, both App2 and App3 close immediately. If you close App2, it will close App3 but not App1. It won't affect App1 and App2 if I close App3. I think they are kind of having parent-child relation. I wonder how to avoid this. I want to close only A, not B and C.

Thanks in advance.

private int i = 0;

private void button1_Click(object sender, EventArgs e)
MethodInvoker m = (MethodInvoker)delegate()
Evidence ev1 = AppDomain.CurrentDomain.Evidence;

AppDomainSetup domaininfo = new AppDomainSetup();
string appPath = Application.ExecutablePath;

string appName = "App" + i.ToString();

domaininfo.ApplicationName = appName;
domaininfo.ApplicationBase = "file:///" + System.Environment.CurrentDirectory;

AppDomain d = AppDomain.CreateDomain(appName, ev1, domaininfo);

d.ExecuteAssembly(@"C:\projects\WindowsApplication 2\bin\Debug\WindowsApplication2.exe");
MessageBox.Show("Closing " + appName);
Apr 26 '06 #1
0 1056

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Fred Palmer | last post: by
6 posts views Thread by Ludvig | last post: by
4 posts views Thread by Ryan | last post: by
22 posts views Thread by Brett Romero | last post: by
1 post views Thread by mindflower | last post: by
13 posts views Thread by Samir Chouaieb | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.