[Mono-bugs] [Bug 417871] Thread.Abort() not working correctly.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Feb 28 13:19:38 EST 2009


User fp at dti-be.com added comment

Fred Peters <fp at dti-be.com> changed:

           What    |Removed                     |Added
                 CC|                            |fp at dti-be.com

--- Comment #3 from Fred Peters <fp at dti-be.com>  2009-02-28 11:19:36 MST ---
I got same issue with Mono 2.2 and found this bug report. So I'm adding some
more information because this is a blocking issue.
This test case works fine with Microsoft .NET

Here is a small test case to simulate the problem:

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace ThreadAbort
    class Program
        static void Main(string[] args)
            Thread thread = new Thread(Execute);
            Console.WriteLine("** End **");

        public static void Execute()
            Console.WriteLine("Thread started");
// This does not work (exception never thrown)
                while (true)
// This would work
//                while (true)
//                    Thread.Sleep(1);
            catch (Exception ex)
                Console.WriteLine("Thread aborted: {0}", ex.Message); 

As seen in the comments above, there is a workaround using a Thread.Sleep() but
this is not acceptable because the purpose of Abort in our application is to
cancel a thread which would be blocked somewhere


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