[Mono-devel-list] some bogus code that makes mcs throw an exception
Sean Neakums
sneakums at zork.net
Wed Jul 21 06:59:34 EDT 2004
$ dpkg -s mono-mcs | grep ^Version:
Version: 1.0-1
$ mcs --version
Mono C# compiler version 1.0.0.0
$ cat foo.cs
using System;
using System.Collections;
class foo {
private static void Up(Hashtable h, String x, String y)
{
try {
h[x + "/" + y] = h[x + "/" + y]++;
} catch {
h[x + "/" + y] = 1;
}
}
public static void Main()
{
Hashtable y = new Hashtable ();
Up(y, "foo", "bar");
Up(y, "foo", "bar");
}
}
$ mcs foo.cs
Exception caught by the compiler while compiling:
Block that caused the problem begin at: foo.cs: (5)
Block being compiled: [foo.cs: (7),foo.cs: (9)]
System.InvalidCastException: Cannot cast from source type to destination type.
in StringConcat.Emit (Mono.CSharp.EmitContext)
in EmptyCast.Emit (Mono.CSharp.EmitContext)
in Argument.Emit (Mono.CSharp.EmitContext)
in Invocation.EmitArguments (Mono.CSharp.EmitContext, System.Reflection.MethodBase, System.Collections.ArrayList)
in Invocation.EmitCall (Mono.CSharp.EmitContext, bool, bool, Mono.CSharp.Expression, System.Reflection.MethodBase, System.Collections.ArrayList, Mono.CSharp.Location)
in IndexerAccess.EmitAssign (Mono.CSharp.EmitContext, Mono.CSharp.Expression)
in UnaryMutator.EmitCode (Mono.CSharp.EmitContext, bool)
in UnaryMutator.Emit (Mono.CSharp.EmitContext)
in Argument.Emit (Mono.CSharp.EmitContext)
in Invocation.EmitArguments (Mono.CSharp.EmitContext, System.Reflection.MethodBase, System.Collections.ArrayList)
in Invocation.EmitCall (Mono.CSharp.EmitContext, bool, bool, Mono.CSharp.Expression, System.Reflection.MethodBase, System.Collections.ArrayList, Mono.CSharp.Location)
in IndexerAccess.EmitAssign (Mono.CSharp.EmitContext, Mono.CSharp.Expression)
in Assign.Emit (Mono.CSharp.EmitContext, bool)
in Assign.EmitStatement (Mono.CSharp.EmitContext)
in StatementExpression.DoEmit (Mono.CSharp.EmitContext)
in Statement.Emit (Mono.CSharp.EmitContext)
in Block.DoEmit (Mono.CSharp.EmitContext)
in Block.Emit (Mono.CSharp.EmitContext)
in Try.DoEmit (Mono.CSharp.EmitContext)
in Statement.Emit (Mono.CSharp.EmitContext)
in Block.DoEmit (Mono.CSharp.EmitContext)
in Block.Emit (Mono.CSharp.EmitContext)
in EmitContext.EmitTopBlock (Mono.CSharp.Block, Mono.CSharp.InternalParameters, Mono.CSharp.Location)
More information about the Mono-devel-list
mailing list