[Mono-list] Emit a local from different ILGenerator

Janet(Zhao-Ping) Tang jtang@tibco.com
Fri, 20 Sep 2002 14:09:45 -0700


Hi,

I was trying to compile a C# project on Linux using mono/mcs-0.15.  The
project compiles fine on Windows using Microsoft .NET SDK.  But I got
the following exception with mono:
Unhandled Exception: Trying to emit a local from a different ILGenerator

in System.Reflection.Emit.ILGenerator:Emit(..)
The exception was thrown by Mono.CSharp.UnaryMutator:EmitCode().
I checked the "expression.cs" in mcs0.15 which contains definition for
UnaryMutator::EmitCode(
EmitContext ec, bool is_expr).  In this function definition, the
instance variable temp_storage is instantiated once with the EmitContext
argument "ec" that is passed in at that time.  The function calls
temp_storage.Store(ec) later on.  However, for different calls of
UnaryMutator::EmitCode() with different EmitContext argument "ec", won't
temp_storage.Store(ec) throw exception because the current "ec" is not
the same one that was used to instantiate temp_storage?

Thanks,

JT