[Mono-devel-list] Enabling iterators

Jonathan Pryor jonpryor at vt.edu
Tue Feb 24 18:08:49 EST 2004


Below...

On Tue, 2004-02-24 at 06:32, Alan Jenkins wrote:
<snip/>
> Has the problem with foreach loops and try blocks inside iterators been
> fixed?

No.  I just tried this.  I've added a new bugzilla bug for this, #54814.

> testing with a try block around a yield statement caused an exception in
> the compiler, this might be an easier line of investigation.

I'm not seeing any compiler errors with this:

	public IEnumerator GetEnumerator () {
		try {yield return "foo";}
		catch {}
	}

However, that code generates an error at runtime, similar to the error
message you were seeing.  In particular, the above code has invalid IL
on the "ret", while yours was due to the "ldfld". 

 - Jon





More information about the Mono-devel-list mailing list