* MessageFormatter.cs: Include the logical context in the message when
authorLluis Sanchez <lluis@novell.com>
Fri, 1 Dec 2006 13:31:21 +0000 (13:31 -0000)
committerLluis Sanchez <lluis@novell.com>
Fri, 1 Dec 2006 13:31:21 +0000 (13:31 -0000)
  throwing an exception. Fixes a compatibility issue with MS.NET.

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

mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs

index 6e9499c4359f9a4097267badda8ec806fd50867f..6d69c37b785f09d4f934e2446fd5e2eff31da1e5 100644 (file)
@@ -1,3 +1,8 @@
+2006-12-01  Lluis Sanchez Gual <lluis@novell.com> 
+
+       * MessageFormatter.cs: Include the logical context in the message when
+         throwing an exception. Fixes a compatibility issue with MS.NET.
+
 2006-10-29  Robert Jordan  <robertj@gmx.net>
 
        * ObjectWriter.cs, ObjectReader [NET_2_0]:
index 6dba9f43eca27e7a69ea0575d14b110cf98c72f1..19dfc70259b216dc9c57ca0dc7cb514d915b4458 100644 (file)
@@ -154,11 +154,12 @@ namespace System.Runtime.Serialization.Formatters.Binary
                        // Type of return value\r
 \r
                        ReturnTypeTag returnTypeTag;\r
+                       MethodFlags contextFlag = MethodFlags.ExcludeLogicalCallContext;\r
 \r
                        if (resp.Exception != null) {\r
                                returnTypeTag = ReturnTypeTag.Exception | ReturnTypeTag.Null;\r
-                               info = new object[] {resp.Exception};\r
                                internalProperties = MethodReturnDictionary.InternalExceptionKeys;\r
+                               infoArrayLength = 1;\r
                        }\r
                        else if (resp.ReturnValue == null) {\r
                                returnTypeTag = ReturnTypeTag.Null;\r
@@ -173,16 +174,13 @@ namespace System.Runtime.Serialization.Formatters.Binary
 \r
                        // Message flags\r
 \r
-                       MethodFlags contextFlag;\r
                        MethodFlags formatFlag;\r
 \r
-                       if ((resp.LogicalCallContext != null) && resp.LogicalCallContext.HasInfo && ((returnTypeTag & ReturnTypeTag.Exception) == 0)\r
+                       if ((resp.LogicalCallContext != null) && resp.LogicalCallContext.HasInfo) \r
                        {\r
                                contextFlag = MethodFlags.IncludesLogicalCallContext;\r
-                               infoArrayLength++;\r
+                               infoArrayLength++;
                        }\r
-                       else\r
-                               contextFlag = MethodFlags.ExcludeLogicalCallContext;\r
 \r
                        if (resp.Properties.Count > internalProperties.Length && ((returnTypeTag & ReturnTypeTag.Exception) == 0))\r
                        {\r
@@ -241,7 +239,10 @@ namespace System.Runtime.Serialization.Formatters.Binary
                        {\r
                                object[] infoArray = new object[infoArrayLength];\r
                                int n = 0;\r
-\r
+
+                               if ((returnTypeTag & ReturnTypeTag.Exception) != 0)
+                                       infoArray[n++] = resp.Exception;\r
+                               \r
                                if (formatFlag == MethodFlags.ArgumentsInMultiArray)\r
                                        infoArray[n++] = resp.Args;\r
 \r
@@ -411,7 +412,8 @@ namespace System.Runtime.Serialization.Formatters.Binary
                                object[] msgInfo = (object[]) result;\r
 \r
                                if ((typeTag & ReturnTypeTag.Exception) > 0) {\r
-                                       exception = (Exception) msgInfo[0];\r
+                                       exception = (Exception) msgInfo[0];
+                                       if (hasContextInfo) callContext = (LogicalCallContext)msgInfo[1];\r
                                }\r
                                else if ((flags & MethodFlags.NoArguments) > 0 || (flags & MethodFlags.PrimitiveArguments) > 0) {\r
                                        int n = 0;\r