[Mono-dev] exception from gmcs

Bas Smit basjsmit at gmail.com
Thu Jan 29 13:58:29 EST 2009


Hi guys,

I've been using the moq framework in a gmcs compiled project and I
encountered some strange behavior. I decided to compile moq with gmcs and
run the test suite. When I tried to compile the moq tests I got an exception
from gmcs. Ive reduced the code that causes the exception to this:

using System;
using System.Linq.Expressions;
using System.Collections.Generic;

static public class Foo
{
    static public int Helper(Expression<Predicate<int>> match)
    {
        return 0;
    }

    static public void Main()
    {
        Expression<Action<List<int>>> exp = x => x.Add( Helper(i => true) );
    }
}

I use "gmcs main.cs" to compile, and get the output below. I hope this
helps.

Regards, Bas Smit

Exception caught by the compiler while emitting:
   Block that caused the problem begin at:
\Solutions\gmcs2\cs\main.cs(13,5):
System.ArgumentNullException: Argument cannot be null.
Parameter name: local
Internal compiler error at \Solutions\gmcs2\cs\main.cs(12,24):: exception
caught
 while emitting MethodBuilder [Foo::Main]

Unhandled Exception: System.ArgumentNullException: Argument cannot be null.
Parameter name: local
  at System.Reflection.Emit.ILGenerator.Emit (OpCode opcode,
System.Reflection.E
mit.LocalBuilder local) [0x00000]
  at Mono.CSharp.LocalInfo.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.VariableReference.EmitLoad (Mono.CSharp.EmitContext ec)
[0x0000
0]
  at Mono.CSharp.VariableReference.Emit (Mono.CSharp.EmitContext ec, Boolean
lea
ve_copy) [0x00000]
  at Mono.CSharp.VariableReference.Emit (Mono.CSharp.EmitContext ec)
[0x00000]
  at Mono.CSharp.ArrayCreation.EmitDynamicInitializers
(Mono.CSharp.EmitContext
ec, Boolean emitConstants) [0x00000]
  at Mono.CSharp.ArrayCreation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary
this
_arg) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, Sy
stem.Collections.ArrayList Arguments, Location loc, Boolean dup_args,
Boolean om
it_args) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, Sy
stem.Collections.ArrayList Arguments, Location loc) [0x00000]
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments) [0x00000]
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.TypeCast.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary
this
_arg) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, Sy
stem.Collections.ArrayList Arguments, Location loc, Boolean dup_args,
Boolean om
it_args) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, Sy
stem.Collections.ArrayList Arguments, Location loc) [0x00000]
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments) [0x00000]
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.TypeCast.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.ArrayCreation.EmitDynamicInitializers
(Mono.CSharp.EmitContext
ec, Boolean emitConstants) [0x00000]
  at Mono.CSharp.ArrayCreation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary
this
_arg) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, Sy
stem.Collections.ArrayList Arguments, Location loc, Boolean dup_args,
Boolean om
it_args) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, Sy
stem.Collections.ArrayList Arguments, Location loc) [0x00000]
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments) [0x00000]
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.TypeCast.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.ArrayCreation.EmitDynamicInitializers
(Mono.CSharp.EmitContext
ec, Boolean emitConstants) [0x00000]
  at Mono.CSharp.ArrayCreation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary
this
_arg) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, Sy
stem.Collections.ArrayList Arguments, Location loc, Boolean dup_args,
Boolean om
it_args) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, Sy
stem.Collections.ArrayList Arguments, Location loc) [0x00000]
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments) [0x00000]
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.TypeCast.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary
this
_arg) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, Sy
stem.Collections.ArrayList Arguments, Location loc, Boolean dup_args,
Boolean om
it_args) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase
method, Sy
stem.Collections.ArrayList Arguments, Location loc) [0x00000]
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments) [0x00000]
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.VariableReference.EmitAssign (Mono.CSharp.EmitContext ec,
Mono.
CSharp.Expression source, Boolean leave_copy, Boolean prepare_for_load)
[0x00000
]
  at Mono.CSharp.Assign.Emit (Mono.CSharp.EmitContext ec, Boolean
is_statement)
[0x00000]
  at Mono.CSharp.Assign.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec)
[0x0000
0]
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.EmitContext.EmitResolvedTopBlock (Mono.CSharp.ToplevelBlock
blo
ck, Boolean unreachable) [0x00000]
  at Mono.CSharp.EmitContext.EmitTopBlock (IMethodData md,
Mono.CSharp.ToplevelB
lock block) [0x00000]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090129/9f7787e8/attachment-0001.html 


More information about the Mono-devel-list mailing list