[Mono-bugs] [Bug 78057][Nor] New - Runtime produces invalid blob for array attributes

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Apr 9 06:24:47 EDT 2006


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 marek.safar at seznam.cz.

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

--- shadow/78057	2006-04-09 06:24:47.000000000 -0400
+++ shadow/78057.tmp.4408	2006-04-09 06:24:47.000000000 -0400
@@ -0,0 +1,122 @@
+Bug#: 78057
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: marek.safar at seznam.cz               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Runtime produces invalid blob for array attributes
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+
+
+Steps to reproduce the problem:
+1. 
+
+using System;
+
+[AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface,
+AllowMultiple = true)]
+public class SimpleAttribute : Attribute {
+        
+        string name = null;
+        
+        public string MyNamedArg;
+        
+        private string secret;
+        
+        public SimpleAttribute (string name)
+        {
+                this.name = name;
+        }
+        
+        public string AnotherArg {
+                get {
+                        return secret;
+                }
+                set {
+                        secret = value;
+                }
+        }
+
+		public object D;
+}
+
+[Simple ("Fifth", D=new double[] { -1 })]
+class Blah2
+{
+}
+
+public class Blah {
+
+        public static int Main ()
+        {
+				object o = (((SimpleAttribute)typeof(Blah2).GetCustomAttributes (typeof
+(SimpleAttribute), false)[0]).D);
+				if (o.ToString () != "System.Double[]")
+					return 1;
+				
+				Console.WriteLine ("OK");
+                return 0;
+        }
+}
+
+2. run
+
+
+Actual Results:
+
+No error on mono runtime
+
+The exception on MS runtime
+
+Unhandled Exception: System.Reflection.CustomAttributeFormatException:
+Binary format of the specified custom attribute was invalid.
+   at System.Reflection.CustomAttribute.GetDataForPropertyOrField(Boolean&
+isProperty, Object& value, Type& type, Boolean isLast)
+   at System.Reflection.CustomAttribute.GetObject()
+   at
+System.Reflection.CustomAttribute.CheckConsistencyAndCreateArray(CustomAttribute
+caItem, Type caType)
+   at System.Reflection.CustomAttribute.GetCustomAttributes(MemberInfo
+member, Type caType, Boolean inherit)
+   at System.Reflection.CustomAttribute.GetCustomAttributes(Type type, Type
+caType, Boolean inherit)
+   at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean
+inherit)
+   at Blah.Main()
+
+
+Expected Results:
+
+Consitent behaviour
+
+How often does this happen? 
+
+
+Additional Information:
+
+Here is the difference.
+
+mcs + mono corlib
+
+  .custom instance void SimpleAttribute::.ctor(string) = ( 01 00 05 46 69
+66 74 68 01 00 53 51 01 44 1D 0D 01 00 00 00 0E FF )                      
+                               
+
+mcs + ms corlib
+
+  .custom instance void SimpleAttribute::.ctor(string) = ( 01 00 05 46 69
+66 74 68 01 00 53 51 01 44 1D 0D 01 00 00 00 00 00 00 00 00 00 F0 BF )


More information about the mono-bugs mailing list