[Mono-bugs] [Bug 58098][Nor] Changed - Assignment of out params is not tracked correctly

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 6 May 2004 22:40:50 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by michi@zeroc.com.

http://bugzilla.ximian.com/show_bug.cgi?id=58098

--- shadow/58098	2004-05-06 10:33:43.000000000 -0400
+++ shadow/58098.tmp.21209	2004-05-06 22:40:50.000000000 -0400
@@ -91,6 +91,62 @@
    static void Main () {
       int i;
       Foo (i);
    }
    static void Foo (out int i) { i = 0; }
 }
+
+------- Additional Comments From michi@zeroc.com  2004-05-06 22:40 -------
+OK, here is the original code that causes the problem. The same code
+compiles fine with Visual C#:
+
+public bool ice_invoke(string operation, OperationMode mode, byte[]
+inParams, out byte[] outParams,
+                               Context context) // Line 174
+        {
+            int __cnt = 0;
+            while(true)
+            {
+                try
+                {
+                    Object_Del __del = __getDelegate();
+                    return __del.ice_invoke(operation, mode, inParams,
+out outParams, context);
+                }
+                catch(IceInternal.NonRepeatable __ex)
+                {
+                    if(mode == OperationMode.Nonmutating || mode ==
+OperationMode.Idempotent)
+                    {
+                        __cnt = __handleException(__ex.get(), __cnt);
+                    }
+                    else
+                    {
+                        __rethrowException(__ex.get());
+                    }
+                }
+                catch(LocalException __ex)
+                {
+                    __cnt = __handleException(__ex, __cnt);
+                }
+            }
+        }
+
+The error message is:
+
+ObjectPrxHelper.cs(174) error CS0177: The out parameter `outParams'
+must be assigned before control leave the current method.
+Compilation failed: 1 error(s), 1 warnings
+
+Line 174 is marked in the above code example. (Note that the line
+number is out by one -- no big deal though.)
+
+A bit of experimenting shows that the try-catch blocks are part of the
+issue: if I remove the try-catch blocks, the error goes away.
+
+I tried to reproduce this with a smaller example, but at least all
+simple approaches don't show the error. Maybe the above will help to
+track this down. If not, please let me know, and I'll try harder.
+
+Cheers,
+
+Michi.