[Mono-list] yield
Bernhard Herzog
schwimmlehrer at gmail.com
Tue Sep 13 14:32:38 EDT 2005
Hello,
I wanted to use yield (like Miguel did it in HttpApplication), but I need to
lock by data. Is this not allowed?
static object lockit = new Object();
public static IEnumerable GetData()
{
lock (lockit)
{
for (int i = 0; i < 10; i++)
yield return true;
}
}
I am getting this error (with Mono, it works with MS.Net):
Unhandled Exception: System.Exception: Trying to emit a local from a
different ILGenerator.
in <0x005e7> System.Reflection.Emit.ILGenerator:Emit (OpCode opcode,
System.Reflection.Emit.LocalBuilder lbuilder)
in <0x0002e> Mono.CSharp.Lock:EmitFinally (Mono.CSharp.EmitContext ec)
in <0x001bd> Mono.CSharp.Iterator:EmitDispose (Mono.CSharp.EmitContext ec)
in <0x00013> Mono.CSharp.Iterator+DisposeMethod:DoEmit
(Mono.CSharp.EmitContext ec)
in <0x00024> Mono.CSharp.Statement:Emit (Mono.CSharp.EmitContext ec)
in <0x000a8> Mono.CSharp.Block:DoEmit (Mono.CSharp.EmitContext ec)
in <0x00254> Mono.CSharp.Block:Emit (Mono.CSharp.EmitContext ec)
in <0x0001b> Mono.CSharp.EmitContext:EmitResolvedTopBlock
(Mono.CSharp.ToplevelBlock block, Boolean unreachable)
in <0x00068> Mono.CSharp.EmitContext:EmitTopBlock (IMethodData md,
Mono.CSharp.ToplevelBlock block, Mono.CSharp.InternalParameters ip)
in <0x001f2> Mono.CSharp.MethodData:Emit (Mono.CSharp.TypeContainer
container, Mono.CSharp.Attributable kind)
in <0x00029> Mono.CSharp.Method:Emit ()
in <0x0064d> Mono.CSharp.TypeContainer:EmitType ()
in <0x012a4> Mono.CSharp.TypeContainer:EmitType ()
in <0x00225> Mono.CSharp.RootContext:EmitCode ()
in <0x00c63> Mono.CSharp.Driver:MainDriver (System.String[] args)
in <0x0000f> Mono.CSharp.Driver:Main (System.String[] args)
TIA
Bernhard
More information about the Mono-list
mailing list