From: Lluis Sanchez Date: Tue, 31 May 2005 20:04:21 +0000 (-0000) Subject: 2005-05-31 Lluis Sanchez Gual X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=577cfcfedf72f24764db65bd207c0a44da07dfe4;p=mono.git 2005-05-31 Lluis Sanchez Gual * ReturnMessage.cs: Added some null checks. * MethodReturnMessageWrapper.cs: Added some null checks. Fixed incorrect cast in the constructor. svn path=/trunk/mcs/; revision=45268 --- diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog index 38ceb177772..95035f78c51 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog @@ -1,3 +1,9 @@ +2005-05-31 Lluis Sanchez Gual + + * ReturnMessage.cs: Added some null checks. + * MethodReturnMessageWrapper.cs: Added some null checks. Fixed + incorrect cast in the constructor. + 2005-05-20 Sebastien Pouliot * AsyncResult.cs: Added new fields (required for stack propagation) to diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.cs index 5f331d72715..9949fe1af68 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.cs @@ -48,9 +48,15 @@ namespace System.Runtime.Remoting.Messaging { public MethodReturnMessageWrapper (IMethodReturnMessage msg) : base (msg) { - _args = ((IMethodCallMessage)WrappedMessage).Args; - _exception = msg.Exception; - _outArgInfo = new ArgInfo (msg.MethodBase, ArgInfoType.Out); + if (msg.Exception != null) { + _exception = msg.Exception; + _args = new object[0]; + } else { + _args = msg.Args; + _return = msg.ReturnValue; + if (msg.MethodBase != null) + _outArgInfo = new ArgInfo (msg.MethodBase, ArgInfoType.Out); + } } public virtual int ArgCount { @@ -89,11 +95,11 @@ namespace System.Runtime.Remoting.Messaging { } public virtual int OutArgCount { - get { return _outArgInfo.GetInOutArgCount(); } + get { return _outArgInfo != null ? _outArgInfo.GetInOutArgCount() : 0; } } public virtual object[] OutArgs { - get { return _outArgInfo.GetInOutArgs (_args); } + get { return _outArgInfo != null ? _outArgInfo.GetInOutArgs (_args) : _args; } } public virtual IDictionary Properties diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs index 2b755592173..8044bd32f5e 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs @@ -64,8 +64,10 @@ namespace System.Runtime.Remoting.Messaging _args = outArgs; _outArgsCount = outArgCount; _callCtx = callCtx; - _uri = request.Uri; - _methodBase = request.MethodBase; + if (request != null) { + _uri = request.Uri; + _methodBase = request.MethodBase; + } if (_args == null) _args = new object [outArgCount]; } @@ -92,7 +94,8 @@ namespace System.Runtime.Remoting.Messaging public bool HasVarArgs { get { - return (MethodBase.CallingConvention | CallingConventions.VarArgs) != 0; + if (_methodBase == null) return false; + else return (_methodBase.CallingConvention | CallingConventions.VarArgs) != 0; } }