[Mono-bugs] [Bug 438454] New: ProcessExit event fires while threadpool thread is running

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 23 14:53:18 EDT 2008


User gert.driesen at pandora.be added comment

           Summary: ProcessExit event fires while threadpool thread is
           Product: Mono: Runtime
           Version: SVN
          Platform: All
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: gonzalo at novell.com
        ReportedBy: gert.driesen at pandora.be
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Apparently, we fire the ProcessExit event even if there's still a threadpool
thread running.

Gonzalo, I noticed this issue while creating a regression test for bug #437888.
Which means I haven't yet applied your fix for that bug (as I first want to get
the wrong behavior on Mono).

I hope you don't mind assigning this one to you. Please feel free to reassign
it to mono-bugs instead.

To reproduce, compile and run the following code on the 1.0 profile:

using System;
using System.Threading;

using System;
using System.Threading;

class Program
        static void Main ()
                AppDomain.CurrentDomain.ProcessExit += new EventHandler
                ThreadPool.QueueUserWorkItem (new WaitCallback (Proc));
                Thread.Sleep (1000);

        static void Proc (object unused)
                Thread.CurrentThread.IsBackground = false;
                Thread.Sleep (5000);
                Console.WriteLine ("done");

        static void AppDomain_ProcessExit (object sender, EventArgs e)
                Console.WriteLine ("exit");

Expected result:

* 1.0 profile or .NET 1.x

only done is written to the console after 5 seconds, and the app never

* 2.0 profile / .NET 2.0 (or higher)

The following is written to the console:

done (after 5 seconds)

and the app terminates immediately after exit was written to the console.

Actual result (on both profiles):

exit is written to the console after 1 second
done is written to the console after 5 second

a few seconds later the app terminates.

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

More information about the mono-bugs mailing list