Bug 321439 (MONO78717) - [ANONYMOUS METHODS] Using.EmitFinally()
Summary: [ANONYMOUS METHODS] Using.EmitFinally()
Status: RESOLVED MOVED
Alias: MONO78717
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-27 20:21 UTC by blackdog
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:02:11 UTC


---- Reported by rmt512@gmail.com 2006-06-27 13:21:17 MST ----

Please fill in this template when reporting a bug, unless you know what you
are doing.
Description of Problem:

public IEnumerable GameIDs()
{
using (IDbConnection dbcon =
ProviderFactory.CreateConnectionFromConfig("PgConnStr")) {
	dbcon.Open();
	IDbCommand dbcmd = null; 	
	using (dbcmd = dbcon.CreateCommand()) {
	dbcmd.CommandText = "select id from instance where startup = 1";
	using (IDataReader reader = dbcmd.ExecuteReader()) {
       		while (reader.Read()) 
       			yield return reader["id"] ;
	}
	}
       }
      }


Compilation fails with Exception

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 <0x000a4> Mono.CSharp.Using:EmitExpressionFinally
(Mono.CSharp.EmitContext ec)
in <0x00060> Mono.CSharp.Using: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 <0x00268> Mono.CSharp.Block:Emit (Mono.CSharp.EmitContext ec)
in <0x0001b> Mono.CSharp.EmitContext:EmitResolvedTopBlock
(Mono.CSharp.ToplevelBlock block, Boolean unreachable)
in <0x0007e> Mono.CSharp.EmitContext:EmitTopBlock (IMethodData md,
Mono.CSharp.ToplevelBlock block)
in <0x001ab> Mono.CSharp.MethodData:Emit (Mono.CSharp.TypeContainer
container, Mono.CSharp.Attributable kind)
in <0x00030> Mono.CSharp.Method:Emit ()
in <0x0064d> Mono.CSharp.TypeContainer:EmitType ()
in <0x012a5> Mono.CSharp.TypeContainer:EmitType ()
in <0x00226> Mono.CSharp.RootContext:EmitCode ()
in <0x00ae4> Mono.CSharp.Driver:MainDriver (System.String[] args)
in <0x00041> Mono.CSharp.Driver:Main (System.String[] args)



---- Additional Comments From martin@ximian.com 2006-09-12 13:10:32 MST ----



*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO78104 ***


Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>ubuntu dapper</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"