[Mono-bugs] [Bug 41638][Blo] New - setted class field value is lost on a proxy object of another domain

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Mon, 21 Apr 2003 07:15:27 -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 gfr@skynet.be.

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

--- shadow/41638	Mon Apr 21 07:15:27 2003
+++ shadow/41638.tmp.21380	Mon Apr 21 07:15:27 2003
@@ -0,0 +1,170 @@
+Bug#: 41638
+Product: Mono/Runtime
+Version: unspecified
+OS: Red Hat 8.0
+OS Details: Red Hat 8 & 9 - mono 0.23 - libgc-6.1-1
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gfr@skynet.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: setted class field value is lost on a proxy object of another domain
+
+Description of Problem:
+
+  The mono run-time doesn't handle correctly a proxied object.
+  The constructor are well called. Inside this constructor, a
+  private field of the System.Object type is created.
+
+  When a call is performed to another method, every field has 
+  lost their setted value. This means that the private field
+  has a null value even if the constructor has correctly set 
+  this field to a non-null value.
+
+The error occurs with the following configuration
+
+  Red Hat 8
+  Mono 0.23
+  libgc-6.1-1
+
+  uname -a give Linux XXXX 2.4.18-19.8.0 #1 Thu Dec 12 05:39:29 EST 2002 
+i686 i686 i386 GNU/Linux
+
+I Have the same problem with
+
+  Red Hat 9
+  Mono 0.23
+  libgc-6.1-1
+
+  ALL package up2date with RHN-Applet at the 04/21/2003
+ 
+Steps to reproduce the problem:
+
+1. Create the file called 'File1.cs' with the
+   following content:
+
+>>> SOT >>>
+using System;
+
+namespace TestLib
+{
+	public interface IControlled
+	{
+		System.Boolean Test ();
+	}
+
+	public class Slave : MarshalByRefObject, IControlled
+	{
+		private System.Object obj;
+
+		public Slave ()
+		{
+			obj = new System.Object ();
+		}
+
+		System.Boolean IControlled.Test ()
+		{
+			return obj != null;
+		}
+	}
+
+	public class Master
+	{
+		public System.Boolean Run ()
+		{
+			System.Boolean result;
+
+            AppDomain   domain = AppDomain.CreateDomain ("TestDomain");
+			IControlled slave = (IControlled) 
+domain.CreateInstanceAndUnwrap (
+				GetType().Assembly.FullName, 
+				(typeof (Slave)).FullName);
+
+			return slave.Test ();
+		}
+	}
+}
+>>> EOT >>>
+ 
+2. Create the file called 'File2.cs' with the
+   following content:
+
+>>> SOT >>>
+using System;
+using TestLib;
+
+namespace TestExe
+{
+	public class BootStrap
+	{
+		static public void Main ()
+		{
+			Master master = new Master ();
+
+			if (master.Run () == false)
+			{
+				System.Console.Out.WriteLine ("Test has 
+failed");
+			}
+			else
+			{
+				System.Console.Out.WriteLine ("Test 
+successfull");
+			}
+		}
+	}
+}
+>>> EOT >>>
+
+3. Create the file build.sh with the following content
+
+>>> SOT >>>
+#!/bin/bash
+echo compiling TestLib.dll with file File1.cs
+mcs -target:library -out:TestLib.dll File1.cs
+echo ""
+
+echo compiling TestExe.exe with file File2.cs
+mcs -target:exe -out:TestExe.exe -r:TestLib.dll File2.cs
+echo ""
+>>> EOT >>>
+
+4. run the command : sh ./build.sh
+
+this command must return the following output:
+
+>>> SOT >>>
+compiling TestLib.dll with file File1.cs
+  Compilation succeeded
+                                                                          
+                                                   
+compiling TestExe.exe with file File2.cs
+  Compilation succeeded
+>>> EOT >>>
+
+5. run the command : mono TestExe.exe
+
+Actual Results:
+
+  Test has failed
+
+Expected Results:
+
+  Test successfull
+
+How often does this happen? 
+
+  Each Time
+
+Additional Information:
+
+  This program has the only intention to show the bug which is
+  the field of a marshalled object from another domain lost it's
+  state between call. This problem are very annoying because it
+  doesn't allow to create any kind of secure server design.