[Mono-bugs] [Bug 484819] New: Compiler crashes when generic interface of type interface is defined later in file

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Mar 12 12:23:24 EDT 2009


           Summary: Compiler crashes when generic interface of type
                    interface is defined later in file
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jaebird at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Description of Problem:

The compiler crashes with a NullReferencedException if an interface type used
within a generic interface appears later in the file. See the following code:

using System;

public interface ITestBase<TInterface>

public interface ITestSub1 : ITestBase<ITestSub2>

public interface ITestSub2 : ITestSub1

Compiler Output:
Unhandled Exception: Mono.CSharp.InternalErrorException:
ITestInterface.cs(11,18): ITestSub2 ---> System.NullReferenceException: Object
reference not set to an instance of an object
  at Mono.CSharp.MemberCache.AddInterface (Mono.CSharp.MemberCache baseCache)
[0x00000] in /home/topaz/mono_svn/mcs/mcs/decl.cs:1865 
  at Mono.CSharp.TypeContainer.DoDefineMembers () [0x00158] in
  at Mono.CSharp.TypeContainer.Define () [0x00012] in
  at Mono.CSharp.RootContext.PopulateTypes () [0x0006e] in
  --- End of inner exception stack trace ---
  at Mono.CSharp.RootContext.PopulateTypes () [0x0007c] in
  at Mono.CSharp.Driver.Compile () [0x0026c] in
  at Mono.CSharp.Driver.Main (System.String[] args) [0x0002f] in

If you swap the order of the last two interface definitions, the compiler does
not throw the error and produces the output.

How often does this happen? 
Every time

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