[Mono-bugs] [Bug 566511] New: Lambda/Expression throws ArgumentException: The field handle and the type handle are incompatible in generic class.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Dec 21 15:13:53 EST 2009


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

http://bugzilla.novell.com/show_bug.cgi?id=566511#c0


           Summary: Lambda/Expression throws ArgumentException: The field
                    handle and the type handle are incompatible in generic
                    class.
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: 32bit
        OS/Version: openSUSE 11.2
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: generics
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: marcin.obel at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Third Party Developer/Partner
           Blocker: Yes


Created an attachment (id=333767)
 --> (http://bugzilla.novell.com/attachment.cgi?id=333767)
Compressed MonoDevelop project to reproduce bug.

Description of Problem:
Lambda/Expression throws ArgumentException: The field handle and the type
handle are incompatible in generic class.


using System;
using System.Linq.Expressions;
using NUnit.Framework;

namespace FieldInfoBug
{
    [TestFixture]
    public class MonoRuntime
    {
        [Test]
        public void Throws_ArgumentException_If_Class_Is_A_Generic()
        {
            // This constructor throws ArgumentException: 
            // The field handle and the type handle are incompatible.
            new GenericClass<object>("value");
        }

        [Test]
        public void Creates_An_Instance_If_Class_Is_NOT_A_Generic()
        {
            // This is OK.
            new TestClass("value");
        }
    }

    public class GenericClass<T>
    {
        public GenericClass(string argument)
        {
            Expression<Func<string>> expression = () => argument;
        }
    }

    public class TestClass
    {
        public TestClass(string argument)
        {
            Expression<Func<object>> expression = () => argument;
        }
    }
}


Steps to reproduce the problem:
1. Extract C# project attached to this report.
2. Open project in MonoDevelop 2.2
3. Execute unit tests available in it.


Actual Results:
Lambda/Expression throws ArgumentException: The field handle and the type
handle are incompatible in generic class.

Expected Results:
No exception.

How often does this happen? 
Everytime.

Additional Information:
The bug was found on openSUSE 11.2 VMWare machine available in Mono downloads.

-- 
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