471,305 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,305 software developers and data experts.

Problems with App Domains

Hi! Sorry for my English. :)

Please consider the following code:

----------------------------------------------------------------------------
-
System.AppDomainSetup ap_setup = new System.AppDomainSetup();
ap_setup.LoaderOptimization = System.LoaderOptimization.MultiDomain;
AppDomain ap = AppDomain.CreateDomain("DomainForWork", null, ap_setup);
System.Security.Policy.Evidence pe = new System.Security.Policy.Evidence();
pe.AddAssembly(ap);
System.Reflection.Assembly a = ap.Load("Classes", pe);
System.Type t = a.GetType( "Global" );
System.Reflection.MethodInfo mi = t.GetMethod("InitColl");
mi.Invoke(null, null);
System.AppDomainSetup ap_setup2 = new System.AppDomainSetup();
ap_setup2.LoaderOptimization = System.LoaderOptimization.MultiDomain;
AppDomain ap2 = AppDomain.CreateDomain("DomainForWork2", null, ap_setup2);
System.Security.Policy.Evidence pe2 = new System.Security.Policy.Evidence();
pe2.AddAssembly(ap2);
System.Reflection.Assembly a2 = ap2.Load("Classes", pe2);
System.Type t2 = a2.GetType( "Global" );
System.Reflection.MethodInfo mi2 = t2.GetMethod("InitColl");
mi2.Invoke(null, null);
----------------------------------------------------------------------------
-

We have dll named "Classes" and we load it in two different application
domains. Then we successfully call static method named "InitColl" in the
first domain, but if we call this method in second domain after calling it
in the first domain, we have an exception. Why call of this method in the
second domain is able to see changes that was made by it in first domain?
Does anyone know what's the problem?
Jul 21 '05 #1
0 933

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Marc Hoeve | last post: by
6 posts views Thread by Jeff Thies | last post: by
9 posts views Thread by tshad | last post: by
1 post views Thread by Paul Fi | last post: by
6 posts views Thread by Ludvig | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.