[Mono-bugs] [Bug 401101] New: (Almost) no error when instantiating generic types with wrong number of arguments

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jun 17 18:23:55 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=401101


           Summary: (Almost) no error when instantiating generic types with
                    wrong number of arguments
           Product: Mono: Runtime
           Version: 1.9.0
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: generics
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: Dax at daxxfiles.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Description of Problem:

Mono can instantiate (and construct, use...) invalid generic types with m
generic arguments, while n != m arguments are expected. As long as n > 0 and m
!= 0, it works all the time. If n > 0 and m = 0, mono SIGABRTs.


Steps to reproduce the problem:

Run and compile:
object o = typeof(List<>).MakeGenericType(typeof(int),
typeof(int)).GetConstructor(Type.EmptyTypes).Invoke(null);
Console.WriteLine(o);
o.GetType().GetMethod("Add").Invoke(o, new object[] { 42 });
Console.WriteLine("Done!");


Actual Results:
It works just fine:
System.Collections.Generic.List`1[System.Int32,System.Int32]
Done!


Expected Results:
An exception at about every call in the whole sample.

How often does this happen?
Every time.


Additional Information:
While this is not critical - actually, it's rather curious than dangerous -
mono should throw exceptions instead of simply aborting or working just fine.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list