[Mono-list] Complier Bug Prevents Compilation

Charles Mason charlie.mas at gmail.com
Tue Oct 7 15:39:13 EDT 2008


Hi All,

I am trying to compile Ninject a C# based Inversion of Control
container in Mono. The trunk version of the Ninject NAnt build script
currently has mono disabled, enabling it produces the below error:

      [csc] Compiling 266 files to
'/usr/src/monoSVN/ninject/trunk/bin/mono-2.0/debug/Ninject.Core.dll'.
      [csc] Exception caught by the compiler while compiling:
      [csc]    Block that caused the problem begin at:
/usr/src/monoSVN/ninject/trunk/src/Core/Activation/Strategies/FieldInjectionStrategy.cs(41,48):
      [csc]                      Block being compiled:
[/usr/src/monoSVN/ninject/trunk/src/Core/Activation/Strategies/FieldInjectionStrategy.cs(42,17):,/usr/src/monoSVN/ninject/trunk/src/Core/Activation/Strategies/FieldInjectionStrategy.cs(73,17):]
      [csc] System.IndexOutOfRangeException: Array index is out of range.
      [csc] Internal compiler error at
/usr/src/monoSVN/ninject/trunk/src/Core/Activation/Strategies/FieldInjectionStrategy.cs(41,48)::
exception caught while emitting MethodBuilder
[FieldInjectionStrategy::Initialize]
      [csc] Unhandled Exception: System.IndexOutOfRangeException:
Array index is out of range.
      [csc]   at Mono.CSharp.ConstraintChecker.CheckConstraint
(IResolveContext ec, System.Type ptype, Mono.CSharp.Expression expr,
System.Type ctype) [0x00000]
      [csc]   at Mono.CSharp.ConstraintChecker.CheckConstraints
(IResolveContext ec, Int32 index) [0x00000]
      [csc]   at Mono.CSharp.ConstraintChecker.CheckConstraints
(IResolveContext ec) [0x00000]
      [csc]   at Mono.CSharp.ConstraintChecker.CheckConstraints
(Mono.CSharp.EmitContext ec, System.Reflection.MethodBase definition,
System.Reflection.MethodBase instantiated, Location loc) [0x00000]
      [csc]   at Mono.CSharp.MethodGroupExpr.OverloadResolve
(Mono.CSharp.EmitContext ec, System.Collections.ArrayList& Arguments,
Boolean may_fail, Location loc) [0x00000]
      [csc]   at Mono.CSharp.Invocation.DoResolveOverload
(Mono.CSharp.EmitContext ec) [0x00000]
      [csc]   at Mono.CSharp.Invocation.DoResolve
(Mono.CSharp.EmitContext ec) [0x00000]
      [csc]   at Mono.CSharp.Expression.Resolve
(Mono.CSharp.EmitContext ec, ResolveFlags flags) [0x00000]
      [csc]   at Mono.CSharp.Expression.Resolve
(Mono.CSharp.EmitContext ec) [0x00000]
      [csc]   at Mono.CSharp.Assign.DoResolve (Mono.CSharp.EmitContext
ec) [0x00000]
      [csc]   at Mono.CSharp.SimpleAssign.DoResolve
(Mono.CSharp.EmitContext ec) [0x00000]
      [csc]   at Mono.CSharp.Expression.Resolve
(Mono.CSharp.EmitContext ec, ResolveFlags flags) [0x00000]
      [csc]   at Mono.CSharp.Expression.Resolve
(Mono.CSharp.EmitContext ec) [0x00000]
      [csc]   at Mono.CSharp.ExpressionStatement.ResolveStatement
(Mono.CSharp.EmitContext ec) [0x00000]
      [csc]   at Mono.CSharp.StatementExpression.Resolve
(Mono.CSharp.EmitContext ec) [0x00000]
      [csc]   at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext
ec) [0x00000]
      [csc]   at Mono.CSharp.ExplicitBlock.Resolve
(Mono.CSharp.EmitContext ec) [0x00000]
      [csc]   at Mono.CSharp.EmitContext.ResolveTopBlock
(Mono.CSharp.EmitContext anonymous_method_host,
Mono.CSharp.ToplevelBlock block, Mono.CSharp.Parameters ip,
IMethodData md, System.Boolean& unreachable) [0x00000]

The same error is produced building it via Mono Develop so its not
related to NAnt. This appears to be a bug in the complier itself.

>From what I can tell its having trouble with a rather harmless looking
method declaration:

    public override StrategyResult Initialize(IContext context)


I am sure internally its a lot more complicated. I would really like
to find a work around so I can get the code to compile on existing
mono installations. Is this a known problem?

Any suggestions would be greatly appreciated.


Charlie M


More information about the Mono-list mailing list