[Mono-list] NullRefException compiling with mcs

Stuart Ballard sballard@netreach.com
Wed, 28 Jan 2004 11:04:03 -0500

Miguel de Icaza wrote:
> It is hard to tell from the stack trace that you provided, and that
> version of the compiler is fairly old, we have fixed roughly a hundred
> bugs since that release.
> It would be useful if you could try with a new compiler, or isolate a
> sample test case.

The 20040111 snapshot has the same problem (stack trace below, I'm not 
sure whether it's identical but it's similar), and since that's the 
latest debian package to have been created, it's the latest that's easy 
for me to test.

I'm pretty sure this is a regression - an older version of mcs was able 
to compile this project without problems. Although it's true that the 
project itself has changed in that time too, none of the changes seem 
particularly likely to break the compiler.

Do you have any suggestions as to how I might go about narrowing down 
the problem? Are there any particular language features that are 
suggested or ruled out by the stack trace?

I'll have a go myself at tracking it down as well, but I'm dealing with 
a compilation involving 102 generated source files (created by nrdo, 
http://savannah.nongnu.org/projects/nrdo) that range in size from 5K to 
50K, so it's hard to know where to begin. There are only a few of the 
files that are truly standalone, but when I tried compiling one of those 
few by itself, the error didn't occur.

I can send you (or someone else) the full source in private email, but I 
appreciate that that's not much use...

Thanks in advance for any tips,

Unhandled Exception: System.NullReferenceException: A null value was 
found where an object instance was required
in <0x0020c> Mono.CSharp.Interface:DefineType ()
in <0x00226> Mono.CSharp.DeclSpace:LookupInterfaceOrClass 
(string,string,bool&)in <0x00285> Mono.CSharp.DeclSpace:FindType 
in <0x0011a> Mono.CSharp.MemberAccess:ResolveAsTypeStep 
in <0x00011> Mono.CSharp.Expression:ResolveAsTypeTerminal 
in <0x0005b> Mono.CSharp.DeclSpace:ResolveTypeExpr 
in <0x004e6> Mono.CSharp.TypeContainer:GetClassBases 
in <0x0022e> Mono.CSharp.TypeContainer:DefineType ()
in <0x00305> Mono.CSharp.RootContext:ResolveTree ()
in <0x00a87> Mono.CSharp.Driver:MainDriver (string[])
in <0x0001a> Mono.CSharp.Driver:Main (string[])

Stuart Ballard, Senior Web Developer
NetReach, Inc.
(215) 283-2300, ext. 126