[Mono-bugs] [Bug 57086][Wis] New - .NET Remoting example bug

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 15 Apr 2004 16:47:41 -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 yom@iaelu.net.

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

--- shadow/57086	2004-04-15 16:47:41.000000000 -0400
+++ shadow/57086.tmp.31432	2004-04-15 16:47:41.000000000 -0400
@@ -0,0 +1,169 @@
+Bug#: 57086
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: Crux 1.3 / Kernel 2.6.5
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: yom@iaelu.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: .NET Remoting example bug
+
+Description of Problem:
+
+I've been trying a little example I got from C# Professionnal 2nd Edition
+Book, which is running on the MS.NET Plateform with no bugs.
+The same example with mono is crashing when Activator.GetObject() method is
+called from the client. The .NET Remoting server is running fine.
+
+
+Steps to reproduce the problem:
+Here are the respective source of the object used byt both the client and
+the server, the server, and of course the client :
+
+##### OBJECT FROM HERE #####
+using System;
+
+public class Hello : System.MarshalByRefObject
+{
+	public Hello()
+	{
+		Console.WriteLine("Hello constructor called");
+	}
+	
+	~Hello()
+	{
+		Console.WriteLine("Hello destructor called");
+	}
+	
+	public string Greeting(string name)
+	{
+		Console.WriteLine("Hello.Greeting() called");
+		return("Hello, " + name);
+	}
+}
+##### OBJECT ENDS HERE #####
+
+##### SERVER FROM HERE #####
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+
+class MainClass
+{
+	[STAThread]
+	public static void Main(string[] args)
+	{
+		TcpServerChannel channel = new TcpServerChannel(8086);
+		ChannelServices.RegisterChannel(channel);
+		
+		RemotingConfiguration.RegisterWellKnownServiceType(
+			typeof(Hello), "Hi", WellKnownObjectMode.SingleCall);
+			
+		Console.WriteLine("Hit to exit!");
+		Console.ReadLine();
+	}
+}
+##### SERVER ENDS HERE #####
+
+##### CLIENT FROM HERE #####
+using System;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+
+class MainClass
+{
+	[STAThread]
+	public static void Main(string[] args)
+	{
+		ChannelServices.RegisterChannel(new TcpClientChannel());
+		Hello obj = (Hello)Activator.GetObject(typeof(Hello),
+"tcp://localhost:8086/Hi");
+		
+		if(obj == null) {
+			Console.WriteLine("could not locate da serveur !");
+			return;
+		}
+		for(int i=0; i<5; i++) {
+			Console.WriteLine(obj.Greeting("John Doe"));
+		}
+	}
+}
+##### CLIENT ENDS HERE #####
+
+Actual Results:
+
+Actually, the server is running fine, only the client crashes with that
+exception stack trace :
+
+##### Exception from the client : Begin #####
+$ mono bin/Debug/Client.exe
+
+Unhandled Exception: System.NullReferenceException: A null value was found
+where an object instance was required.
+in <0x00175>
+System.Runtime.Remoting.Channels.Tcp.TcpClientChannel:CreateMessageSink
+(string,object,string&)
+in <0x0004f>
+System.Runtime.Remoting.Channels.ChannelServices:CreateClientChannelSinkChain
+(System.Runtime.Remoting.Channels.IChannelSender,string,object[],string&)
+in <0x002b7>
+System.Runtime.Remoting.Channels.ChannelServices:CreateClientChannelSinkChain
+(string,object,string&)
+in <0x00025>
+System.Runtime.Remoting.RemotingServices:GetClientChannelSinkChain
+(string,object,string&)
+in <0x000b2>
+System.Runtime.Remoting.RemotingServices:GetOrCreateClientIdentity
+(System.Runtime.Remoting.ObjRef,System.Type,object&)
+in <0x0001c> System.Runtime.Remoting.RemotingServices:GetRemoteObject
+(System.Runtime.Remoting.ObjRef,System.Type)
+in <0x00043> System.Runtime.Remoting.RemotingServices:Connect
+(System.Type,string)
+in <0x0000e> System.Activator:GetObject (System.Type,string)
+in <0x00047> MainClass:Main (string[])
+##### Exception from the client : End #####
+
+
+Expected Results:
+
+the expected resuls from the client are :
+
+##### Expected Client Results #####
+Hello, John Doe
+Hello, John Doe
+Hello, John Doe
+Hello, John Doe
+Hello, John Doe
+###################################
+
+and the server should give also
+##### Expected Server Results #####
+Hit to exit!
+Hello construtor called
+Hello construtor called
+Hello.Greeting called
+Hello construtor called
+Hello.Greeting called
+Hello construtor called
+Hello.Greeting called
+Hello construtor called
+Hello.Greeting called
+Hello construtor called
+Hello.Greeting called
+###################################
+
+How often does this happen?
+
+For now it's happening all the time with this configuration.
+
+
+I hope this would help you to debug this part of Mono :)