[Mono-bugs] [Bug 55872][Nor] New - CustomAttributeBuilder doesn't check param types

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 21 Mar 2004 09:48:25 -0500 (EST)


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 ndrochak@gol.com.

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

--- shadow/55872	2004-03-21 09:48:25.000000000 -0500
+++ shadow/55872.tmp.28027	2004-03-21 09:48:25.000000000 -0500
@@ -0,0 +1,44 @@
+Bug#: 55872
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Fedora 1.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ndrochak@gol.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CustomAttributeBuilder doesn't check param types
+
+From unit tests in corlib I noticed that CustomAttributeBuilder doesn't 
+check the types of the paramters passed against the types that are in the 
+ConstructorInfo.
+
+The following code snippet should throw an ArgumentException but it 
+doesn't:
+
+Type [] ctorParams = new Type [] { typeof (string), typeof (string) };
+			
+			ConstructorInfo classCtorInfo = 
+				typeof (CustomAttribute).GetConstructor 
+(ctorParams);
+
+			CustomAttributeBuilder typeCABuilder = new 
+CustomAttributeBuilder (
+				classCtorInfo,
+				new object [] { "1", 123 },//<--here is 
+the error,(int instead of string)
+				new PropertyInfo[]{ typeof 
+(CustomAttribute).GetProperty ("AttributeOne") },
+				new object [] { "TestCase" },
+				typeof (CustomAttribute).GetFields (),
+				new object [] { "FeildValue" }
+				);
+
+I gave up trying to fix this myself.  Hacking on SRE is very tricky :)