[Mono-bugs] [Bug 42934][Maj] Changed - AppDomainSetup+NUnit causes assertion violation in mono

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 13 May 2003 17:49:46 -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 jonpryor@vt.edu.

http://bugzilla.ximian.com/show_bug.cgi?id=42934

--- shadow/42934	Tue May 13 17:20:38 2003
+++ shadow/42934.tmp.24418	Tue May 13 17:49:46 2003
@@ -83,6 +83,43 @@
 tried any other version of NUnit.
 
 ------- Additional Comments From jonpryor@vt.edu  2003-05-13 17:20 -------
 In order to write a correct NUnit Test Case for 36280, I need to be
 able to create an AppDomain (so that it can refer to the correct
 ConfigurationFile).  This is impossible, due to the assertion.
+
+------- Additional Comments From jonpryor@vt.edu  2003-05-13 17:49 -------
+After more research, the problem appears to be caused by creating an
+AppDomainSetup instance from within a user-created AppDomain. 
+Consider the following program (which doesn't require NUnit):
+
+    // Creating AppDomains from within AppDomains seems to cause problems
+    using System;
+    using System.Diagnostics;
+
+    public class X : MarshalByRefObject {
+
+      public void Run ()
+      {
+        Console.WriteLine ("inside X; current domain: {0}",
+AppDomain.CurrentDomain);
+        AppDomainSetup ads = new AppDomainSetup ();
+      }
+    }
+
+    public class R {
+      public static void Main ()
+      {
+        AppDomain domain = AppDomain.CreateDomain ("X");
+        Type t = typeof(X);
+        X x = (X) domain.CreateInstanceAndUnwrap (t.Assembly.FullName,
+t.FullName);
+        x.Run ();
+      }
+    }
+
+This program creates a new domain ("X"), creates an object within that
+domain, and invokes a method on that object (X.Run), which in turn
+tries to create an AppDomainSetup instance.  This generates the same
+assertion as before.
+
+It would seem that AppDomain creation doesn't set the Assembly properly.