2005-05-31 Lluis Sanchez Gual <lluis@novell.com>
authorLluis Sanchez <lluis@novell.com>
Tue, 31 May 2005 20:04:21 +0000 (20:04 -0000)
committerLluis Sanchez <lluis@novell.com>
Tue, 31 May 2005 20:04:21 +0000 (20:04 -0000)
* ReturnMessage.cs: Added some null checks.
* MethodReturnMessageWrapper.cs: Added some null checks. Fixed
incorrect cast in the constructor.

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

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

index 38ceb1777725ac2a6365d8ed4b2ad622c2a43a7a..95035f78c51629c38323606bc004797fe1c121a8 100644 (file)
@@ -1,3 +1,9 @@
+2005-05-31  Lluis Sanchez Gual  <lluis@novell.com>
+
+       * ReturnMessage.cs: Added some null checks.
+       * MethodReturnMessageWrapper.cs: Added some null checks. Fixed
+       incorrect cast in the constructor.
+
 2005-05-20  Sebastien Pouliot  <sebastien@ximian.com>
 
        * AsyncResult.cs: Added new fields (required for stack propagation) to
index 5f331d72715b5603716c95fdceaf032c6bdce060..9949fe1af6832c0b39d651cc15620a0bced8d2d1 100644 (file)
@@ -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 
index 2b75559217385953215298fad26d4a8dbad2013a..8044bd32f5ec11b489072a515831a4e2bd4a6286 100644 (file)
@@ -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;
                        }
                }