[Mono-bugs] [Bug 74411][Nor] New - Missing stack frames when using multiple (>2) appdomains
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 5 Apr 2005 10:41:42 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by sebastien@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=74411
--- shadow/74411 2005-04-05 10:41:42.000000000 -0400
+++ shadow/74411.tmp.25456 2005-04-05 10:41:42.000000000 -0400
@@ -0,0 +1,150 @@
+Bug#: 74411
+Product: Mono: Runtime
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: sebastien@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Missing stack frames when using multiple (>2) appdomains
+
+Description of Problem:
+We're missing some stack frames when dealing with multiple appdomain. I
+seems to work with 2 appdomain (AD1 calling AD2) but doesn't work if AD1
+executes AD2 that calls AD3.
+
+
+Steps to reproduce the problem:
+
+1. IMPORTANT: Edit the source of /mcs/class/corlib/System/AppDomain.cs
+ Change property DynamicDirectory to return Environment.StackTrace
+
+2. Compile the sample as "appdomain1.exe"
+
+using System;
+using System.IO;
+using System.Security.Permissions;
+
+class Program {
+
+// [FileIOPermission (SecurityAction.Deny, Unrestricted = true)]
+ static void Test (string path)
+ {
+ AppDomainSetup setup = new AppDomainSetup ();
+ setup.ApplicationName = "CAS";
+ setup.PrivateBinPath = path;
+ setup.DynamicBase = path;
+
+ Console.WriteLine (">CreateDomain");
+ AppDomain ad = AppDomain.CreateDomain ("CAS", null, setup);
+ Console.WriteLine ("<CreateDomain");
+ Console.WriteLine (Environment.StackTrace);
+ Console.WriteLine (">DynamicDirectory");
+ Console.WriteLine (ad.DynamicDirectory);
+ Console.WriteLine ("<DynamicDirectory");
+ }
+
+ static void Main (string[] args)
+ {
+ string temp = Path.GetTempPath ();
+ Test (temp);
+ }
+}
+
+3. Execute appdomain1.exe
+
+% mono appdomain1.exe
+>CreateDomain
+<CreateDomain
+
+ at Program.Test ()
+ at Program.Main ()
+>DynamicDirectory
+
+ at System.AppDomain.get_DynamicDirectory ()
+ at Program.Test ()
+ at Program.Main ()
+<DynamicDirectory
+
+This works as expected.
+
+4. Compile this sample as "appdomain2.exe"
+
+using System;
+using System.IO;
+using System.Security.Permissions;
+
+class Program {
+
+ static void Test (string assemblyname)
+ {
+ Console.WriteLine (">CreateDomain");
+ AppDomain ad = AppDomain.CreateDomain ("Loader");
+ Console.WriteLine ("<CreateDomain");
+
+ Console.WriteLine (">ExecuteAssembly");
+ ad.ExecuteAssembly (assemblyname);
+ Console.WriteLine ("<ExecuteAssembly");
+ }
+
+ static void Main (string[] args)
+ {
+ Test (args [0]);
+ }
+}
+
+
+5. Execute appdomain2.exe with appdomain1.exe as a parameter.
+
+% mono appdomain2.exe appdomain1.exe
+
+
+Actual Results:
+
+>CreateDomain
+<CreateDomain
+>ExecuteAssembly
+>CreateDomain
+<CreateDomain
+
+ at Program.Test ()
+ at Program.Main ()
+ at System.AppDomain.ExecuteAssembly ()
+ at System.AppDomain.ExecuteAssembly ()
+ at System.AppDomain.ExecuteAssembly ()
+ at Program.Test ()
+ at Program.Main ()
+>DynamicDirectory
+
+ at System.AppDomain.get_DynamicDirectory ()
+ at System.AppDomain.ExecuteAssembly ()
+ at Program.Test ()
+ at Program.Main ()
+<DynamicDirectory
+<ExecuteAssembly
+
+
+Expected Results:
+
+The second stack should be a superset of the first one.
+However we're missing the direct caller Program.Test () and a lot of frames
+until we reach the three last frames.
+
+
+How often does this happen?
+
+Always when using more than 2 appdomains.
+
+
+Additional Information:
+
+- This configuration is common when using nunit to test appdomain features.
+- Missing stack frames means missing CAS declarative security checks :-(