[Mono-bugs] [Bug 76575][Min] New - [PATCH] MethodInfo.MakeGenericType() returns null when the count of args is unexpected

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Oct 27 15:28:01 EDT 2005


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 atsushi at ximian.com.

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

--- shadow/76575	2005-10-27 15:28:01.000000000 -0400
+++ shadow/76575.tmp.9358	2005-10-27 15:28:01.000000000 -0400
@@ -0,0 +1,54 @@
+Bug#: 76575
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [PATCH] MethodInfo.MakeGenericType() returns null when the count of args is unexpected
+
+When users pass a wrong number of Type arguments to
+MethodInfo.MakeGenericMethod(), it should raise ArgumentException, while we
+just return null.
+
+using System;
+using System.Reflection;
+
+class Goo
+{
+        public void Foo<T> () {}
+
+        public static void Main ()
+        {
+                MethodInfo mi = typeof (Goo).GetMethod ("Foo");
+                MethodInfo gmi = mi.MakeGenericMethod ();
+                Console.WriteLine (gmi == null);
+        }
+}
+
+
+Actual Results:
+
+prints "True".
+
+Expected Results:
+
+something like:  Unhandled Exception: System.ArgumentException: The type or
+method has 1 generic parameter(s) but 0 generic argument(s) were provided.
+
+How often does this happen? 
+
+consitently.
+
+Additional Information:
+
+Attaching a runtime patch.


More information about the mono-bugs mailing list