[Mono-bugs] [Bug 29881][Wis] New - Mono aborts on PropertyInfo.GetValue

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
4 Sep 2002 16:54:29 -0000


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 jonpryor@vt.edu.

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

--- shadow/29881	Wed Sep  4 12:54:29 2002
+++ shadow/29881.tmp.4579	Wed Sep  4 12:54:29 2002
@@ -0,0 +1,97 @@
+Bug#: 29881
+Product: Mono/Runtime
+Version: unspecified
+OS: Red Hat 7.3
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jonpryor@vt.edu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono aborts on PropertyInfo.GetValue
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+Mono occasionally aborts execution on PropertyInfo.GetValue().  Note
+"occasionally" -- it only (currently) happens when reflecting on the
+properties of ``System.CLSCompliantAttribute'' (other attributes don't
+exhibit this behavior), and only for one of the properties on
+CLSCompliantAttribute.
+
+Steps to reproduce the problem:
+1. Compile the following C# code:
+
+        // file: ca.cs
+        // custom attributes
+
+        using System;
+        using System.Reflection;
+        using System.Text;
+
+        [CLSCompliant(false)]
+        public class Test {}
+
+        public class ca {
+
+          private static void PrintCustomAttributes (MemberInfo m)
+          {
+            object[] attrs = m.GetCustomAttributes (true);
+            object a = attrs[0];
+            string p = GetPropertyValues (a.GetType().GetProperties(), a);
+          }
+
+          private static string GetPropertyValues (PropertyInfo[] props,
+object instance)
+          {
+            int len = props.Length;
+            StringBuilder sb = new StringBuilder ();
+            for (int i = 0; i != len; ++i) {
+              Console.Error.WriteLine ("i={0}", i);
+              sb.Append (props[i].GetValue (instance, null));
+            }
+            return sb.ToString();
+          }
+
+          public static void Main () {
+            PrintCustomAttributes (typeof(Test));
+          }
+        }
+
+
+
+2. Compile the sample program: mcs ca.cs
+3. Execute the program: mono ca.exe
+
+Actual Results:
+
+i=0
+i=1
+
+** ERROR **: file marshal.c: line 1618 (mono_marshal_get_runtime_invoke):
+should not be reached
+aborting...
+Trace/breakpoint trap
+
+
+Expected Results:
+
+No output.
+
+How often does this happen? 
+
+Always.
+
+Additional Information:
+
+The abort occurs when accessing the second property of
+CLSCompliantAttribute, the IsCompliant property (on my machine, anyway).  I
+can't see any reason why this would be special (CLSCompliantAttribute looks
+normal enough), but other attributes have not caused this problem.