[Mono-bugs] [Bug 653940] New: Referencing nested class in generic parent across assemblies causes CS1503

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 16 07:43:25 EST 2010


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

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


           Summary: Referencing nested class in generic parent across
                    assemblies causes CS1503
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.8.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: j.bogdoll at gmx.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.11)
Gecko/20101013 Ubuntu/9.04 (jaunty) Firefox/3.6.11

A nested class (C2) declared as a child of a generic class (C1<T>) cannot be
referenced from a different assembly (causes error CS1503), but a reference in
the same assembly is fine.

The bug happens both in the packaged 2.8 sources as well as in master.

----- lib.cs -----------------------------
using System;

namespace Testcase
{
  public class C1<T>
  {
    public class C2
    {
      public C1<T> M { get; set; }
    }
  }

  public class C3
  {
    public void M1(C1<object>.C2 Arg)
    {
      Arg.M = null;
    }
  }
}
----- lib.cs -----------------------------

----- test.cs ----------------------------
using System;

namespace Testcase
{
  public class T
  {
    static void Main()
    {
      C1<object>.C2 c2 = new C1<object>.C2();
      C3 c3 = new C3();
      c3.M1(c2);
    }
  }
}
----- test.cs ----------------------------


Reproducible: Always

Steps to Reproduce:
1. gmcs /out:lib.dll /t:library lib.cs
2. gmcs /r:lib.dll /out:test.exe test.cs

Actual Results:  
test.cs(13,10): error CS1502: The best overloaded method match for
`Testcase.C3.M1(Testcase.C1<object>.C2)' has some invalid arguments
/home/bogdoll/testcase/lib.dll (Location of the symbol related to previous
error)
test.cs(13,10): error CS1503: Argument `#1' cannot convert
`Testcase.C1<object>.C2' expression to type `Testcase.C1<object>.C2'
test.cs(13,10): (equally named types possibly from different assemblies in
previous error)
/home/bogdoll/testcase/lib.dll (Location of the symbol related to previous
error)
Compilation failed: 2 error(s), 0 warnings


Expected Results:  
Successful compilation.

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


More information about the mono-bugs mailing list