* CADMessages.cs: Revert last change. It was ok.
authorLluis Sanchez <lluis@novell.com>
Wed, 28 Apr 2004 18:39:26 +0000 (18:39 -0000)
committerLluis Sanchez <lluis@novell.com>
Wed, 28 Apr 2004 18:39:26 +0000 (18:39 -0000)
* MethodResponse.cs, ReturnMessage.cs: Handle output parameters in a
  different way. The message is constructed from an array that has all
  parameters, including input parameters (which will be set to null).
  The Args property returns all arguments. OutArgs returns only the
  output arguments, which are taken from the provided args list.

svn path=/trunk/mcs/; revision=26186

mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs
mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog
mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs
mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs

index 8bdce4721d09435446a66d32cdade7c2fde760ec..0c4d1de5f5e3881dead33224254c9e1a201c7a07 100755 (executable)
@@ -366,7 +366,7 @@ namespace System.Runtime.Remoting.Messaging {
                        _propertyCount = MarshalProperties (retMsg.Properties, ref serializeList);
 
                        _returnValue = MarshalArgument ( retMsg.ReturnValue, ref serializeList);
-                       _args = MarshalArguments ( retMsg.OutArgs, ref serializeList);
+                       _args = MarshalArguments ( retMsg.Args, ref serializeList);
 
                        if (null != retMsg.Exception) {
                                if (null == serializeList)
index 0f4ed75b96186d9be2e5651841bffcdde0256bb9..d8e6f93e4126b3c3a7bd00acdf7a8ed83deb656c 100644 (file)
@@ -1,3 +1,12 @@
+2004-04-28  Lluis Sanchez Gual  <lluis@ximian.com>
+
+       * CADMessages.cs: Revert last change. It was ok.
+       * MethodResponse.cs, ReturnMessage.cs: Handle output parameters in a
+         different way. The message is constructed from an array that has all
+         parameters, including input parameters (which will be set to null).
+         The Args property returns all arguments. OutArgs returns only the
+         output arguments, which are taken from the provided args list.
+       
 2004-04-26  Lluis Sanchez Gual  <lluis@ximian.com>
 
        * CADMessages.cs: Marshal the correct return args for the return message.
index ec4cda5906472a018235ea83e7d71e6d1c66f645..7480e0d114220e7635edf01c39d0c17fb39df9c7 100644 (file)
@@ -76,7 +76,7 @@ namespace System.Runtime.Remoting.Messaging {
                        
                        _exception = null;
                        _returnValue = returnValue;
-                       _outArgs = outArgs;
+                       _args = outArgs;
                }
 
                internal MethodResponse (IMethodCallMessage msg, CADMethodReturnMessage retmsg) {
@@ -92,7 +92,7 @@ namespace System.Runtime.Remoting.Messaging {
 
                        _exception = retmsg.GetException (args);
                        _returnValue = retmsg.GetReturnValue (args);
-                       _outArgs = retmsg.GetArgs (args);
+                       _args = retmsg.GetArgs (args);
 
                        _callContext = retmsg.GetLogicalCallContext (args);
                        if (_callContext == null) _callContext = new LogicalCallContext ();
@@ -116,7 +116,7 @@ namespace System.Runtime.Remoting.Messaging {
                                case "__MethodSignature": _methodSignature = (Type[]) value; break;
                                case "__Uri": _uri = (string) value; break;
                                case "__Return": _returnValue = value; break;
-                               case "__OutArgs": _outArgs = (object[]) value; break;
+                               case "__OutArgs": _args = (object[]) value; break;
                                case "__fault": _exception = (Exception) value; break;
                                case "__CallContext": _callContext = (LogicalCallContext) value; break;
                                default: Properties [key] = value; break;
@@ -185,18 +185,18 @@ namespace System.Runtime.Remoting.Messaging {
 
                public int OutArgCount {
                        get { 
-                               if (null == _outArgs)
-                                       return 0;
-
-                               return _outArgs.Length;
+                               if (_args.Length == 0) return 0;
+                               if (_inArgInfo == null) _inArgInfo = new ArgInfo (MethodBase, ArgInfoType.Out);
+                               return _inArgInfo.GetInOutArgCount ();
                        }
                }
 
                public object[] OutArgs {
                        get { 
-                               if (null == _outArgs)
-                                       return new object[0];
-
+                               if (_outArgs == null) {
+                                       if (_inArgInfo == null) _inArgInfo = new ArgInfo (MethodBase, ArgInfoType.Out);
+                                       _outArgs = _inArgInfo.GetInOutArgs (_args);
+                               }                                       
                                return _outArgs;
                        }
                }
@@ -243,15 +243,15 @@ namespace System.Runtime.Remoting.Messaging {
 
                public object GetArg (int argNum)
                {
-                       if (null == _outArgs)
+                       if (null == _args)
                                return null;
 
-                       return _outArgs [argNum];
+                       return _args [argNum];
                }
 
                public string GetArgName (int index)
                {
-                       throw new NotSupportedException ();
+                       return MethodBase.GetParameters()[index].Name;
                }
 
                public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
@@ -263,7 +263,7 @@ namespace System.Runtime.Remoting.Messaging {
                                info.AddValue ("__MethodSignature", _methodSignature);
                                info.AddValue ("__Uri", _uri);
                                info.AddValue ("__Return", _returnValue);
-                               info.AddValue ("__OutArgs", _outArgs);
+                               info.AddValue ("__OutArgs", _args);
                        }
                        else
                                info.AddValue ("__fault", _exception);
@@ -278,10 +278,8 @@ namespace System.Runtime.Remoting.Messaging {
 
                public object GetOutArg (int argNum)
                {
-                       if (null == _methodBase)
-                               return null;
-
-                       return _outArgs [argNum];
+                       if (_inArgInfo == null) _inArgInfo = new ArgInfo (MethodBase, ArgInfoType.Out);
+                       return _args[_inArgInfo.GetInOutArgIndex (argNum)];
                }
 
                public string GetOutArgName (int index)
@@ -320,14 +318,14 @@ namespace System.Runtime.Remoting.Messaging {
                        }
                        else
                        {
-                               if (_outArgs != null)
+                               if (_args != null)
                                {
-                                       for (int n=0; n<_outArgs.Length; n++)
+                                       for (int n=0; n<_args.Length; n++)
                                        {
                                                if (n>0) s+= ", ";
-                                               if (_outArgs[n] != null) s += _outArgs[n].GetType().Name + " ";
+                                               if (_args[n] != null) s += _args[n].GetType().Name + " ";
                                                s += GetOutArgName (n);
-                                               if (_outArgs[n] != null) s += " = {" + _outArgs[n] + "}";
+                                               if (_args[n] != null) s += " = {" + _args[n] + "}";
                                                else s+=" = {null}";
                                        }
                                }
index 82cf5bb8aef2b44b56b57d39714c43b56ddc760d..d322235f5bfd4706a814716cab32033a91a23bd2 100644 (file)
@@ -157,8 +157,8 @@ namespace System.Runtime.Remoting.Messaging {
                public object [] OutArgs {
                        get {
                                if (_outArgs == null) {
-                                       _outArgs = new object [OutArgCount];
-                                       Array.Copy (_args, _outArgs, OutArgCount);
+                                       if (_inArgInfo == null) _inArgInfo = new ArgInfo (MethodBase, ArgInfoType.Out);
+                                       _outArgs = _inArgInfo.GetInOutArgs (_args);
                                }                                       
                                return _outArgs;
                        }
@@ -172,7 +172,8 @@ namespace System.Runtime.Remoting.Messaging {
 
                public object GetOutArg (int arg_num)
                {
-                       return _args[arg_num];
+                       if (_inArgInfo == null) _inArgInfo = new ArgInfo (MethodBase, ArgInfoType.Out);
+                       return _args[_inArgInfo.GetInOutArgIndex (arg_num)];
                }
 
                public string GetOutArgName (int arg_num)