[Mono-bugs] Found an endless loop bug in mcs

Juanval juanval at gmail.com
Thu Sep 22 11:18:16 EDT 2005


Hi there
I'm working on a gtk-sharp program, and after some late night stupid
coding, when trying to compile the project, mcs got into an endless
loop. I've tracked down the bug to some 20 lines of code. If I remove
any line more, mcs stops hanging.

So, here's the code:
--------------------------------------8<--------------------------------------
using System;
using Gtk;

namespace Foo
{
    public class Bar
    {
        TreeView myTreeView;

        void LoopMethod(string query)
        {
            int i = 0;
            TreeIter iter;
            myTreeView.Model.GetIterFirst(out iter);

            myTreeView.Model.Foreach(delegate(TreeModel model,TreePath
path,TreeIter iter)
                    {
                    if(((string)model.GetValue(iter,0))==query)
                        myTreeView.Model.SetValue(iter, 1,"hey");
                    return false;
                    });
        }
    }
}
-------------------------------------->8--------------------------------------

If I compile this with "mcs endlessLoop.cs  -pkg:gtk-sharp" mcs just
hangs there using all CPU.

I'm using mcs version: Mono C# compiler version 1.1.8.0, if that helps.

I haven't checked if this bug has been already fixed in newer mcs
snapshots. If that's the case, please forgive me.

Bye


More information about the mono-bugs mailing list