[Mono-dev] NullReferenceException with mcs/gmcs

Felipe Almeida Lessa felipe.lessa at gmail.com
Sun Nov 13 09:58:04 EST 2005


Hello,

I think I found a bug. I don't know if it's already known, so I'm
sending a message here instead of filling a bug report.

mcs and gmcs both are giving me the following stack trace when trying
to compile the "bug.cs" file attached ("mcs bug.cs"):

Unhandled Exception: System.NullReferenceException: Object reference
not set to an instance of an object
in <0x000a5> System.Reflection.Emit.ILGenerator:Emit (OpCode opcode,
System.Reflection.Emit.LocalBuilder lbuilder)
in <0x00120> Mono.CSharp.Try:DoEmit (Mono.CSharp.EmitContext ec)
in <0x00024> Mono.CSharp.Statement:Emit (Mono.CSharp.EmitContext ec)
in <0x000a8> Mono.CSharp.Block:DoEmit (Mono.CSharp.EmitContext ec)
in <0x00254> Mono.CSharp.Block:Emit (Mono.CSharp.EmitContext ec)
in <0x0001b> Mono.CSharp.EmitContext:EmitResolvedTopBlock
(Mono.CSharp.ToplevelBlock block, Boolean unreachable)
in <0x00068> Mono.CSharp.EmitContext:EmitTopBlock (IMethodData md,
Mono.CSharp.ToplevelBlock block, Mono.CSharp.InternalParameters ip)
in <0x001f2> Mono.CSharp.MethodData:Emit (Mono.CSharp.TypeContainer
container, Mono.CSharp.Attributable kind)
in <0x00029> Mono.CSharp.Method:Emit ()
in <0x0064d> Mono.CSharp.TypeContainer:EmitType ()
in <0x00225> Mono.CSharp.RootContext:EmitCode ()
in <0x00c63> Mono.CSharp.Driver:MainDriver (System.String[] args)
in <0x0000f> Mono.CSharp.Driver:Main (System.String[] args)

This stack trace makes me think this problem is with
System.Reflection.Emit, not the compilers. Also, this file is the
smallest test case I could write to show this problem.

My versions:
$ mcs --version
Mono C# compiler version 1.1.9.1
$ mono --version
Mono JIT compiler version 1.1.9.2, (C) 2002-2005 Novell, Inc and
Contributors. www.mono-project.com
        TLS:           normal
        GC:            Included Boehm (with typed GC)
        SIGSEGV      : normal
        Globalization: normal
$ dpkg -l mono mono-\* | grep ^ii | awk '{print $2 "\t" $3}'
mono    1.1.9.2-1
mono-assemblies-base    1.1.9.2-1
mono-classlib-1.0       1.1.9.2-1
mono-classlib-1.0-dbg   1.1.9.2-1
mono-classlib-2.0       1.1.9.2-1
mono-classlib-2.0-dbg   1.1.9.2-1
mono-common     1.1.9.2-1
mono-devel      1.1.9.2-1
mono-gac        1.1.9.2-1
mono-gmcs       1.1.9.2-1
mono-jay        1.1.9.2-1
mono-jit        1.1.9.2-1
mono-mcs        1.1.9.2-1
mono-utils      1.1.9.2-1
mono-xsp        1.0.5-2


See ya,
Felipe.


--
"Quem excele em empregar a força militar subjulga os exércitos dos outros
povos sem travar batalha, toma cidades fortificadas dos outros povos sem as
atacar e destrói os estados dos outros povos sem lutas prolongadas. Deve
lutar sob o Céu com o propósito primordial da 'preservação'. Desse modo suas
armas não se embotarão, e os ganhos poderão ser preservados. Essa é a
estratégia para planejar ofensivas."

  -- Sun Tzu, em "A arte da guerra"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.cs
Type: text/x-csharp
Size: 385 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20051113/70449d6c/attachment.bin 


More information about the Mono-devel-list mailing list