[Mono-list] compiling source code - strange exception

Jonathan Pryor jonpryor@vt.edu
Thu, 12 Aug 2004 07:21:52 -0400


On Thu, 2004-08-12 at 01:31, Tomek Soroka wrote:
<snip/>
> Unhandled Exception: System.InvalidCastException: Cannot cast from 
> source type to destination type.
> in <0x00073> Mono.CSharp.StringConcat:Emit (Mono.CSharp.EmitContext)
> in <0x00135> Mono.CSharp.FieldExpr:EmitAssign 
> (Mono.CSharp.EmitContext,Mono.CSharp.Expression)
> in <0x002aa> Mono.CSharp.Assign:Emit (Mono.CSharp.EmitContext,bool)
> in <0x00016> Mono.CSharp.Assign:EmitStatement (Mono.CSharp.EmitContext)
> in <0x001de> Mono.CSharp.TypeContainer:EmitFieldInitializers 
> (Mono.CSharp.EmitContext)
> in <0x00388> Mono.CSharp.Constructor:Emit (Mono.CSharp.TypeContainer)
> in <0x00427> Mono.CSharp.TypeContainer:Emit ()
> in <0x00896> Mono.CSharp.RootContext:EmitCode ()
> in <0x00c35> Mono.CSharp.Driver:MainDriver (string[])
> in <0x00012> Mono.CSharp.Driver:Main (string[])
<snip/>
> How Can I try to get know what's going on... where is this exception 
> etc...?

The exception is occurring within mcs, the C# compiler.

It is due to one of two things: a bug within the compiler, or invalid
code (and mcs doesn't correctly capture the exception to report a human
readable error message).

If you could post the smallest source code that causes this exception
message (and tell us if the code compiles under Microsoft CSC.EXE, if
possible), that would help.

Thanks,
 - Jon