[Mono-dev] NullReferenceException with mcs/gmcs

Marek Safar marek.safar at seznam.cz
Tue Nov 15 03:47:42 EST 2005


Hello Felipe,

To resolve this problem, please update to the latest mcs version.

Regards,
Marek
>
> (sorry if I'm sending this again, but for me looks like the message
> didn't make it to the list the last time I sent it)
>
> 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.
>   
> ------------------------------------------------------------------------
>
> using System;
>
> class MainClass {
>         public static void Main() {
>                 try {
>                 } catch (Exception e) {
>                         TestMethod(delegate {
>                                         Console.WriteLine(e);
>                                         });
>                 }
>         }
>
>         public static void TestMethod(EventHandler handler) {
>         }
> }
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>   




More information about the Mono-devel-list mailing list