[Mono-bugs] [Bug 71084][Wis] New - AppDomain unload locks up with MarshalByRefObject

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 7 Jan 2005 07:18:42 -0500 (EST)


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 ximian@gibber.freeserve.co.uk.

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

--- shadow/71084	2005-01-07 07:18:42.000000000 -0500
+++ shadow/71084.tmp.5080	2005-01-07 07:18:42.000000000 -0500
@@ -0,0 +1,99 @@
+Bug#: 71084
+Product: Mono: Class Libraries
+Version: 1.0
+OS: 
+OS Details: Microsft Windows 2000 Server 5.002195 SP4
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ximian@gibber.freeserve.co.uk               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: AppDomain unload locks up with MarshalByRefObject
+
+Description of Problem:
+
+If a MarshallByRefObject is created in an AppDomain, when that AppDomain 
+is unloaded, the application locks up. Using the --verbose flag indicates 
+a NullReferenceException is thrown during System.AppDomain:DoDomainUnload.
+
+I presume the exception should not be thrown in the first place, but 
+should it be caught and whatever is waiting on the tear down allowed to 
+continue?
+
+Steps to reproduce the problem:
+
+1. Build and execute the code given in Additional Information
+
+2. Execution never completes
+
+3. Comment out the line starting:
+
+      Remote remote = (Remote) appDomain.CreateInstanceAndUnwrap
+
+4. Build and execute, execution completes normally
+
+5. Uncomment the above line and also the following line:
+
+      //   [Serializable]
+
+6. Change the line:
+
+      public class Remote : MarshalByRefObject
+
+   to:
+
+      public class Remote // : MarshalByRefObject
+
+4. Build and execute, execution completes normally
+
+Actual Results:
+
+When the Remote class is either not instantiated or not derived from 
+MarshalByRefObject, the code works normally. Otherwise it locks up.
+
+Expected Results:
+
+The same code run under Microsoft.Net 1.1 executes normally in all cases.
+
+How often does this happen? 
+
+Everytime
+
+Additional Information:
+
+I have Mono-1.0.5 installed. The Microsoft.Net framework is not installed. 
+The machine is running Windows 2000 Server.
+
+Code sample:
+
+using System;
+using System.Runtime.Remoting.Messaging;
+
+namespace ConsoleTest
+{
+   class Class1
+   {
+      [STAThread]
+      static void Main(string[] args)
+      {
+         AppDomain appDomain = AppDomain.CreateDomain("AnotherDomain");
+
+         Remote remote = (Remote) appDomain.CreateInstanceAndUnwrap(typeof
+(Remote).Assembly.FullName, typeof(Remote).FullName);
+
+         AppDomain.Unload(appDomain);
+         appDomain = null;
+      }
+   }
+
+//   [Serializable]
+   public class Remote : MarshalByRefObject
+   {
+   }
+}