[Mono-list] [TestCase] NullRefException compiling with mcs

Stuart Ballard sballard@netreach.com
Fri, 30 Jan 2004 10:01:12 -0500


This is a multi-part message in MIME format.
--------------090801040905020503090401
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Actually I found it and produced a very simple testcase - turned out I 
needed to include at least one class that *implemented* the interface as 
well as the one that declared it. I've attached the files but I can also 
include them here in their entirety:

InnerInterface.cs:

public class Outer {
   public interface Inner {
   }
}

Impl.cs:

public class Impl : Outer.Inner {
}


Compiling these files in the order given, with "mcs InnerInterface.cs 
Impl.cs", works fine.

Compiling them in the opposite order, with "mcs Impl.cs 
InnerInterface.cs", gives the error.

Incidentally, if "Inner" is a class rather than an interface, a similar 
bug manifests. You don't get a crash, but you get an erroneous claim 
that the class definition of Inner is circular. Again, this only happens 
if "Impl.cs" is specified first on the commandline.

The fact that the Class case is caught by a circularity handler, but the 
Interface case is not, suggests to my untrained eye that there may also 
be a problem in catching circularity problems with interfaces. I haven't 
attempted to verify that, because I don't have sufficient depth of 
understanding to be sure that I'm creating a circularity in the right 
form that it would be caught by the same codepath, but it might be worth 
looking into why the behavior of Classes versus Interfaces differs in 
this way.

Stuart.


-- 
Stuart Ballard, Senior Web Developer
NetReach, Inc.
(215) 283-2300, ext. 126
http://www.netreach.com/

--------------090801040905020503090401
Content-Type: text/plain;
 name="Impl.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Impl.cs"

public class Impl : Outer.Inner {
}

--------------090801040905020503090401
Content-Type: text/plain;
 name="InnerInterface.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="InnerInterface.cs"

public class Outer {
  public interface Inner {
  }
}

--------------090801040905020503090401--