[Mono-bugs] [Bug 473569] Deadlock when using NUnit + SWF + threads

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Feb 6 17:30:13 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=473569

User aaragoneses at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=473569#c2





--- Comment #2 from Andrés G. Aragoneses <aaragoneses at novell.com>  2009-02-06 15:30:13 MST ---
This code is less risky (because it gives more time to ShowDialog to execute
until it gets blocked) but generates a worst hang (and in MS.NET it works):

using System;
using SWF = System.Windows.Forms;

using NUnit.Framework;
using System.Threading;

namespace UiaAtkBridgeTest
{


    [TestFixture]
    public class DialogTester
    {

        [Test]
        public void OpenFileDialog()
        {
            TestDialog(new SWF.OpenFileDialog());
        }

        static void TestDialog(SWF.CommonDialog dialog)
        {
            new DialogTester(dialog).Test();
        }

        public class DialogTester
        {
            SWF.CommonDialog dialog;
            Thread th;

            internal DialogTester(SWF.CommonDialog dialog)
            {
                this.dialog = dialog;
            }

            internal void Test()
            {
                th = new Thread(new ThreadStart(Show));
                th.SetApartmentState(ApartmentState.STA);
                try
                {
                    th.Start();
                }
                finally
                {
                    Thread.Sleep(3000);
                    dialog.Dispose();
                    th.Abort();
                }
            }

            private void Show()
            {
                dialog.ShowDialog();
            }
        }
    }
}

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list