[Mono-devel-list] Enabling iterators

Alan Jenkins sourcejedi at phonecoop.coop
Tue Feb 24 06:32:09 EST 2004


On Sun, 2004-02-22 at 01:34, Miguel de Icaza wrote:
> Yes, that was a buglet in 0.30, I think 0.30.1 shipped with a fix. 

Ok.  I havent upgraded yet (just modified the compiler as shown and
recompiled).

Has the problem with foreach loops and try blocks inside iterators been
fixed?

e.g.

public class Iterable {

	Enumerable e;

	public Iterable (Enumerable e)
	{
		this.e = e;
	}

	public IEnumerator GetEnumerator ()
	{
		foreach (object o in e)
			yield return o;
	}
}

this particular example compiles, but fails with
Invalid IL code at IL001b in .__Proxy_0:System.IEnumerator.MoveNext ():
IL_001b: ldfld     0x04000006

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

I am using mono 0.30 and mcs 0.30 (with the iterator option buglet
removed), so obviouslly this may have been fixed by now.

Thanks !

(I apologise for initially sending this message directly to Miguel)



More information about the Mono-devel-list mailing list