Hi, I'm working with Mono 0.15 (RH7.3 downloaded from the mono website) and I encountered the following problem while compiling some code.
Unhandled Exception: System.NullReferenceException: A null value was found
where an object instance was required
in (unmanaged) 00 Mono.CSharp.Expression:Constantify (object,System.Type)
in <0x004cd> 00 Mono.CSharp.MemberAccess:ResolveMemberAccess
(Mono.CSharp.EmitContext,Mono.CSharp.Expression,Mono.CSharp.Expression,Mono.
CSharp.Location,Mono.CSharp.Expression)
in <0x0075b> 00 Mono.CSharp.MemberAccess:DoResolve
(Mono.CSharp.EmitContext,Mono.CSharp.Expression,Mono.CSharp.ResolveFlags)
in <0x0001b> 00 Mono.CSharp.MemberAccess:DoResolve (Mono.CSharp.EmitContext)
in <0x00149> 00 Mono.CSharp.Expression:Resolve
(Mono.CSharp.EmitContext,Mono.CSharp.ResolveFlags)
in <0x00132> 00 Mono.CSharp.Assign:DoResolve (Mono.CSharp.EmitContext)
in <0x00149> 00 Mono.CSharp.Expression:Resolve
(Mono.CSharp.EmitContext,Mono.CSharp.ResolveFlags)
in <0x00019> 00 Mono.CSharp.StatementExpression:Resolve
(Mono.CSharp.EmitContext)
in <0x00118> 00 Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext)
in <0x00100> 00 Mono.CSharp.EmitContext:EmitTopBlock
(Mono.CSharp.Block,Mono.CSharp.InternalParameters,Mono.CSharp.Location)
in <0x005c5> 00 Mono.CSharp.MethodData:Emit
(Mono.CSharp.TypeContainer,Mono.CSharp.Block,object)
in <0x0001f> 00 Mono.CSharp.Method:Emit (Mono.CSharp.TypeContainer)
in <0x0027b> 00 Mono.CSharp.TypeContainer:Emit ()
in <0x004dd> 00 Mono.CSharp.RootContext:EmitCode ()
in <0x00732> 00 Mono.CSharp.Driver:MainDriver (string[])
in <0x0000b> 00 Mono.CSharp.Driver:Main (string[])
The compiler parses the file but during code generation something goes
wrong.
I tried to isolate the problem and found the line of code that causes the
problem. I then tried to reproduce the problem by writing a small test
program. Up to this point I did not manage to do so (only partly).
The problem manifests itself when I use a 'const int' that is declared in
another assembly. If a make a small 'test' assembly with a class that has
also a 'public const int' then the problem is gone.
The small program listed below reproduces the problem with the assembly
provided with this mail (attachement).
using DecoderNameSpace;
namespace MonoTest
{
public class TestClass
{
static void Main(string[] args)
{
TestClass t = new TestClass();
}
public void TestMethod()
{
int i = Header.SINGLE_CHANNEL; // <=== MCS Crashes on this
line, see
stack dump
}
}
}
Has anybody an idea what causes this problem or is it a known problem? If
not I can submit a problem report or supply the code that builds the decoder
assembly.
regards,
Tom
decoder.zip
Description: Zip compressed data
