+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.
_exception = null;
_returnValue = returnValue;
- _outArgs = outArgs;
+ _args = outArgs;
}
internal MethodResponse (IMethodCallMessage msg, CADMethodReturnMessage retmsg) {
_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 ();
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;
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;
}
}
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)
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);
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)
}
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}";
}
}