[Mono-bugs] [Bug 535807] New: Using generics causes a System.TypeLoadException

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Aug 31 20:43:08 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=535807


           Summary: Using generics causes a System.TypeLoadException
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.4.x
          Platform: i386
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: ppinmatt at videotron.ca
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3pre)
Gecko/20090810 Ubuntu/9.04 (jaunty) Shiretoko/3.5.2

I get the following runtime exception when running code that contains generics.
It compiles and runs fine howewer, without generics.

Unhandled Exception: System.TypeLoadException: Could not load type
'test.EnumerableClass' from assembly 'Main, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null'.


Reproducible: Always

Steps to Reproduce:
Compile the following code:

using System;
using System.Collections.Generic;

namespace test
{
    class EnumerableClass : IEnumerable<int>
    {
        int[] ints = new int[100];

        public IEnumerator<int> GetEnumerator()
        {
            for(int i = 0; i < 100; i++)
                yield return ints[i];
        }
    }

    class MainClass
    {
        public static void Main(string[] args)
        {
            EnumerableClass c = new EnumerableClass();

            foreach(int i in c)
            {
                System.Console.Write(i);
            }
        }
    }
}
Actual Results:  
Unhandled Exception: System.TypeLoadException: Could not load type
'test.EnumerableClass' from assembly 'Main, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null'.


Expected Results:  
No exception

-- 
Configure bugmail: http://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