[Mono-bugs] [Bug 645992] New: Using generic with dynamic from different assembly doesn't work

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Oct 12 21:33:16 EDT 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=645992#c0


           Summary: Using generic with dynamic from different assembly
                    doesn't work
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: mono at e-tobi.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


This is similar to #645572 which Marek Safar already fixed (Thx!)
But this time, the dynamic is within a generic type.

Say we have an assembly test1 with a single class:

[test1.cs]

public class Bar
{
    public Bar()
    {
       DynamicList = new List<dynamic> { "test" };
    }

    public List<dynamic> DynamicList { get; set; }
}


Now create an executable that references and uses this assembly:

[test2.cs]

using System;

public class Foo : Bar
{
    public static void Main()
    {
       new Foo().FooMethod();
    }

    public void FooMethod()
    {
        Console.WriteLine(DynamicList[0].ToUpper());
    }
}

Compiling test2.cs will fail:

$ dmcs test2.cs -r:test1
test2.cs(12,42): error CS1061: Type `object' does not contain a definition for
`ToUpper' and no extension method `ToUpper' of type `object' could be found
(are you missing a using directive or an assembly reference?)
Compilation failed: 1 error(s), 0 warnings

But compiling everything into one executable/assembly works just fine:

$ dmcs test2.cs test1.cs
$ mono test2.exe
TEST

(Tested with ac277b3917)

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